Citizen Card v1 to v2: What Changed for Developers

Avatar
Author

Five things changed for Cartão de Cidadão v2 developers. Keys moved from RSA to ECDSA. [...]

For contact-mode operations, updating the middleware is generally enough with no significant integration change. Contactless, however, requires new SDK methods. Anything that verifies signatures or uses the SDK cryptography methods needs attention because of ECDSA, which is where most Cartão de Cidadão v2 developers lose time.

The new Cartão de Cidadão has been issued since June 2024, redesigned for the security and format standards of Regulation (EU) 2019/1157, which had been in application since 2 August 2021 and was replaced by Regulation (EU) 2025/1208 on 9 July 2025. Old cards that are still valid keep working, so your code has to handle both indefinitely rather than migrating from one to the other.

June 2024
Portugal begins issuing the Cartão de Cidadão v2
3.12.0
First middleware release supporting the new card: contactless interface and ECDSA
3.13.0
.NET 8/9 SDK module, macOS PteidToken updated, contactless signing performance
3.14.0
Travel data reading for the new card and other ICAO Doc 9303 documents
If your integration predates mid-2024, the likely outcome is not a crash. It is a subtle failure on some cards and not others.

Cartão de Cidadão v2 for developers: what changed from v1?

Keys
RSA becomes ECDSA
v1 uses RSA. v2 uses elliptic curve keys and certificates. The official documentation is explicit that this must be taken into account in applications using the SDK cryptography methods or verifying data signed by the card.
Interface
Contactless arrives
v2 supports contactless reading over ISO/IEC 14443. Contact mode works after updating the software with no significant integration change. Contactless requires the newer SDK methods.
Physical
Contacts moved to the back
On the new card the chip contacts are on the reverse of the document. This explains a share of support cases nobody associates with the card version.
Trust chain
Intermediate CAs may be missing
When v2 cards are used with the PKCS#11 module, intermediate certification authorities may not be returned. Obtain them in advance from the official PKI page, or at the time of use through the AIA extension.
Both versions remain in circulation, so Cartão de Cidadão v2 developers keep supporting v1 as well. The middleware update guarantees compatibility with the new model and with older models still valid and in use.

Why does ECDSA break code that looked algorithm-agnostic?

Because a lot of code is not as agnostic as it reads. It surfaces in four places: a hardcoded algorithm identifier in a signature verification routine written when RSA was the only option, a validation library configured with an allowed algorithm list nobody has revisited, key size assumptions in buffer handling or database column definitions, and test fixtures containing only RSA-signed material.

The fourth costs the most time, because it produces a green build and a failing system. If your test data was captured before mid-2024, it contains no ECDSA cards at all.

What is the CAN, and what is PACE doing?

Two different things, often confused. The Card Access Number is a six-digit code printed in the lower right corner of the new card, and it exists to prevent unauthorised contactless reading. It is not a PIN. It is distinct from the authentication, signature and address PINs, and it is not secret in the same way: anyone holding the card can read it. It proves physical possession, not consent. One implementation detail: when calling C_Login through PKCS#11 in contactless mode with a v2 card, the CAN is passed as the PIN parameter, which nothing in the parameter name suggests.

PACE is the authentication protocol protecting contactless use, described in part 11 of ICAO Document 9303. Access control to the data on the contactless chip is performed through PACE using data read from the document Machine Readable Zone, or optionally, in the case of cards, through the CAN. Security is additionally guaranteed by passive authentication of the datagroups, and chip authentication through Active Authentication and Chip Authentication mechanisms.

The three things you have to build for v2
CAN capture
Six digits from the card, required for contactless. Decide deliberately whether you cache it
PACE handling
Travel document machinery, not national eID machinery. Budget learning time if your team has not worked with e-passports
Version detection
No PKCS#11 API reports card type or mode. Attempt init without PIN or CAN, retry with the CAN
Which matters for one practical reason: this is travel document machinery. If your team has worked with electronic passports, this is familiar. If not, the learning time has nothing to do with the Citizen Card specifically.

One user experience detail worth designing for. The desktop application asks for the CAN on first contactless use and does not ask again for subsequent uses with the same card, with an option not to store it. If you build your own flow, decide deliberately whether you cache the CAN, because the convenience and the security argument point in opposite directions and the decision belongs to your product owner rather than to whoever writes the dialog.

Have an integration that predates the new card and nobody is sure what it does on v2?
Talk to our team

What changes in the certificate chain?

This is the change most likely to reach production undetected, because it depends on which interface your code uses. Chain building becomes your responsibility rather than something the module hands you. Code that assumed a complete chain arrives from the token will fail validation on v2 while continuing to work on v1, which is exactly the pattern that gets diagnosed as a bad card.

And if you fetch intermediates at runtime through AIA, you have introduced a network dependency into a verification path. Decide whether that is acceptable, and if it is not, pre-load and cache them with a plan for updating. The desktop application documentation includes a troubleshooting section on problems with the new trust chain, which is a reasonable signal that this is not a theoretical concern.

What is the shortest migration checklist for Cartão de Cidadão v2 developers?

Update the middleware to 3.12.0 or later, and record which version you are certified against.
Search your codebase for RSA assumptions: algorithm identifiers, allowed algorithm lists, key size constants.
Add ECDSA material to your test fixtures. Without this, nothing else in the list is verifiable.
Implement and test explicit version detection, with logging. When a support case describes "it does not work", the first useful question is which card version and which interface, answered from logs rather than by asking the user.
Fix chain building for the case where intermediates are not returned, and decide between pre-loading and AIA fetching.
Plan contactless only if you need it. The new SDK methods, CAN capture in your interface, and a decision on caching it. Contact mode alone needs none of this.

There is a test mode, and it matters more than it sounds. The SDK documentation refers to configuring one alongside the contactless access section. PIN codes block after three wrong attempts, unblocking requires an in-person visit with the PIN letter, and developers testing signature flows against real cards have blocked them. Find that section before your first signature test, not after.

The sixth item is the only genuinely new development. The first five are a morning of reading your own code followed by fixing what you find, and they are what separates an integration that works on both cards from one that works on the cards your developer happens to own. If you are starting from scratch rather than migrating, our guide on integrating the Citizen Card into private applications covers the ground before this one.

Related reading

Integrating the Citizen Card into private applications The parent article. Which of the three integration paths fits, and what the reader layer costs you.
Which sectors must accept the EUDI Wallet by 2027? The obligation that arrives alongside the card, and the two conditions that decide whether it applies to you.
eIDAS 2.0 implementation guide Written from the perspective of a team maintaining national eID middleware since 2011.
How Cabo Verde built digital identity for an archipelago eID middleware designed for offline capability and remote activation.
eID Box The middleware product built on this work.

Frequently asked questions

Cartão de Cidadão v2 for developers: what changed

What changed between Cartão de Cidadão v1 and v2?
The v2 card, issued since June 2024, uses ECDSA keys and certificates instead of RSA, supports contactless reading over ISO/IEC 14443 protected by the PACE protocol, introduces a six-digit CAN code for contactless access, and has the chip contacts on the back of the document. Middleware support starts at version 3.12.0. The changes are documented in the project repository and in the official manuals.
Will code written for the old Citizen Card still work?
For contact-mode operations, updating the software is generally sufficient with no significant integration change. Contactless requires new SDK methods. Code that verifies signatures or uses the SDK cryptography methods needs revisiting because the new card uses ECDSA, and intermediate CAs may not be returned through PKCS#11 on v2.

CAN and version detection

What is the CAN on the Portuguese Citizen Card?
The Card Access Number is a six-digit code printed in the lower right corner of the new Citizen Card. It is required for contactless reading and is distinct from the authentication, signature and address PINs. When using C_Login through PKCS#11 in contactless mode, the CAN is passed as the PIN parameter.
How do you tell whether a card is v1 or v2?
You have to implement it. There is currently no dedicated PKCS#11 API to check the card type or whether contactless mode is in use, so developers must implement their own strategy. One documented approach is to attempt initialisation without a PIN or CAN, and retry with the CAN if that fails.

Certificates and testing

Why does certificate validation fail on the new card but not the old one?
Because intermediate certification authorities may not be returned when v2 cards are used with the PKCS#11 module. Obtain them in advance from the official PKI page, or at the time of use through the Authority Information Access extension present in each certificate. Code that assumed a complete chain from the token will fail on v2 only.
Can you test signature flows without blocking real cards?
The SDK documentation describes configuring a test mode, and it is worth finding before your first signature test. PIN codes block after three wrong attempts, and unblocking requires an in-person visit to an IRN counter with the card and the PIN letter.
Caixa Mágica Software
Caixa Mágica Team
Caixa Mágica Software is a Portuguese software company with 20+ years of experience delivering custom software, AI solutions and nearshore development teams for European businesses. We have worked on Portuguese national eID middleware for over a decade.
eID Box · Caixa Mágica Software
Migrating an integration that predates the new card?
Send us the middleware version you are on and where you verify signatures. We have worked on Portuguese national eID middleware for over a decade, so that conversation is short.