Citizen Card Middleware –

Caixa Mágica Software created an open-source, robust, and advanced middleware for the Portuguese ID Card, driven by the need to enhance the digital functionalities of the card and strengthen security in online transactions.


In 2011, Caixa Mágica Software faced the challenge of creating an open-source, robust, and advanced middleware for the Portuguese ID Card, driven by the need to enhance the digital functionalities of the card and strengthen security in online transactions. The objective was to establish a versatile solution that provided secure authentication, qualified digital signatures, and efficient integration with digital services, simplifying the interaction between citizens and government organizations.

This project continues to be developed by CMS in collaboration with the National Printing House (INCM), Agency for Administrative Modernization (AMA), and the Institute of Registries and Notaries (IRN).


Caixa Mágica chose to use the Qt Framework and the C/C++ programming language, combined with open-source technologies such as OpenSSL and Poppler. This choice allowed the creation of a highly modular and adaptable middleware, meeting the technical and functional requirements established by the Agency for Administrative Modernization (AMA), the Institute of Registries and Notaries (IRN), and the National Printing House (INCM). The development follows agile methodologies, with regular updates. The solution is comprehensively documented in repositories on GitHub, ensuring transparency and accessibility to all interested parties. Furthermore, the choice of the EUPL – European Union Public Licence 1.2 reinforced the commitment to open source.

In terms of functionalities, we can highlight:

  • Digital Certificate Management: The middleware manages digital certificates present on the Portuguese Citizen Card, ensuring they are up-to-date and ready for use in authentication and digital signatures.
  • Access to Personal Data: Authorized applications can access personal data stored on the Portuguese Citizen Card, such as name, identification number, photograph, and official address, in accordance with the cardholder’s permissions.
  • Digital Signature: Facilitates the use of the Portuguese Citizen Card for electronically signing documents, contracts, and online transactions, ensuring authenticity and integrity in signatures. This middleware can be defined as the “layer” of software between the computer and the Portuguese Citizen Card, providing authentication and electronic signature functionalities to the operating system and other applications.
  • Authentication: Enables citizens to use the Portuguese Citizen Card for secure authentication in online services, confirming the identity of the cardholder when accessing digital services.
  • Security: Plays a crucial role in security, ensuring that operations performed with the Portuguese Citizen Card are secure and that the cardholder’s personal information is protected.
  • Integration: Allows the integration of the Portuguese Citizen Card with various government and commercial applications, making it a versatile tool for accessing digital services such as tax declaration, healthcare, and online banking.
  • Mobile Digital Key (Chave Móvel Digital): The Portuguese Citizen Card Middleware allows signatures with the Mobile Digital Key (CMD) within the middleware’s graphical application as well as in other system applications. The middleware integrates services available through the Agency for Administrative Modernization (AMA). The Mobile Digital Key (CMD) is a means of authentication and digital signature certified by the Portuguese state. It allows the CMD holder to access various public or private portals and sign digital documents with a single login. The Mobile Digital Key associates a mobile phone number with the identification document of an individual, whether it is the Portuguese Citizen Card or Identity Card, or for foreign residents in Portugal, it is associated with the passport, residence title, or card.
  • Professional Attributes: The System of Certification of Professional Attributes (SCAP) allows citizens, through the Portuguese Citizen Card or the Mobile Digital Key, to sign a document in their professional capacity in public institutions or private companies. For more information, click here.


The solution from Caixa Mágica has had and continues to have a significant impact in Portugal. All citizens and businesses that interact with the government use, directly or indirectly, the Citizen Card Middleware. The open-source nature and active community surrounding the project ensure long-term sustainability. Government funding, coupled with ongoing community participation and support from Caixa Mágica, solidify the solution’s position as an essential pillar in Portugal’s digital transformation.

Here are some significant and resulting outcomes highlighted from the development and implementation of the Citizen Card Middleware:

  • Widespread Usage: All citizens and businesses interact directly or indirectly with the Middleware, streamlining processes and providing security in digital transactions.
  • Official Signatures: It has become the exclusive solution for signatures on government documents and tenders, establishing a standard for reliable authentication.
  • Private Adoption: Private usage is on the rise, with citizens turning to digital signatures as a secure alternative to handwritten signatures in personal transactions.
  • Integration with Regulatory Entities: Successful integration with the Commercial Registry Authority allows citizens to sign as company administrators, and qualified professionals can sign documents related to their professions.

Caixa Mágica Software, in collaboration with government entities, has built an innovative solution that has overcome significant challenges. The Portuguese Citizen Card Middleware not only met technological and functional needs but also set a standard for public-private collaboration and effective use of open source, promoting transparency. This case study highlights not only the effectiveness and innovation of the solution but also its positive, continuous, and direct impact on society.

You can access the Portuguese Citizen Card Middleware’s Git page here.