Document status: approved by the CNA TC Terminal. The nine specifications it describes are available as a preview on the documentation site; their formal release is pending.
Preamble
The purpose of this document is to present all the evolutions of the Terminal APIs between the Keypop Java versions currently in production and the current specifications of the CNA Terminal APIs — for validation by the members of the TC Terminal (Technical Committee Terminal) of the Calypso Networks Association (CNA).
Compared versions
The “before” reference consists of the latest published versions of the Keypop Java modules (production tags). The “after” reference consists of the normative specifications (index.adoc) and the associated class diagrams (uml/class-diagram.puml) of each calypsonet-terminal-*-api-spec repository.
| API | Specification reference | Keypop Java version in production (before) | Specified version (after) |
|---|---|---|---|
| Terminal Reader API | CNA-TR-API | keypop-reader-java-api 2.1.0 | 3.0.0 |
| Terminal Card API (internal) | CNA-TC-API | keypop-card-java-api 2.0.1 | 3.0.0 |
| Terminal Calypso Card API | CNA-TCC-API | keypop-calypso-card-java-api 2.3.0 | 3.0.0 |
| Terminal Reader Definitions API (new) | CNA-TRD-API | — | 1.0.0 |
| Terminal Calypso Crypto Legacy SAM API | CNA-TCCL-API | keypop-calypso-crypto-legacysam-java-api 1.0.0 | 2.0.0 |
| Terminal Calypso Crypto Symmetric API | CNA-TCCS-API | keypop-calypso-crypto-symmetric-java-api 0.1.1 | 0.2.0 |
| Terminal Calypso Crypto Asymmetric API | CNA-TCCA-API | keypop-calypso-crypto-asymmetric-java-api 0.2.0 | 0.3.0 |
| Terminal Generic Card API | CNA-TGC-API | keypop-genericcard-jvm-api 1.0.0 | 2.0.0 |
| Terminal Storage Card API | CNA-TSC-API | keypop-storagecard-java-api 1.2.0 | 2.0.0 |
All the specifications are currently in …-SNAPSHOT versions.
For each evolution theme, it describes:
- the motivation (the “why”);
- the detailed changes in each of the APIs concerned;
- the design rationale (the “why this choice rather than another”).
Annex A additionally provides an exhaustive, API-by-API mapping between each element of the Java versions in production and what becomes of it in the specifications.
Alignment of the Keypop Java implementations with these versions and the writing of a technical migration guide for integrators will take place subsequently, after validation by the TC Terminal (see §22).
API visibility with respect to audiences
- The Reader API, the Calypso Card API, the Terminal Reader Definitions API, the Legacy SAM API, the Generic Card API and the Storage Card API are public APIs, directly manipulated by the integrator (application code).
- The Card API is an internal API: it serves as an integration contract between reader implementations and card extensions. The integrator does not have access to it.
- The Crypto Symmetric API and Crypto Asymmetric API define the contracts (SPI) between the Calypso Card API and the cryptographic modules; the integrator only uses them indirectly, through the crypto modules it instantiates (for example the Legacy SAM API).
This document describes the evolutions of all impacted APIs because they are coupled at the design level. The evolutions of the internal and contract APIs require no action from the integrator; they are absorbed by the Keypop implementations.
New API: Terminal Reader Definitions API
Version 3.0.0 introduces a new foundation API dedicated to hosting cross-cutting enumerated types of the Terminal APIs. It is created on the occasion of Theme 6 to host
RfTechnologyandCardType, but its scope is broader: it is intended to potentially host other enumerations that constitute global constants shared by several Terminal APIs. The Terminal Reader API now depends on this new API.Concretely, this translates into:
- a new repository:
calypsonet-terminal-reader-definitions-api-spec(version1.0.0-SNAPSHOT);- a new Keypop Java module:
keypop-reader-definitions-jvm-api(to be created, in accordance with the Keypop naming convention);- a declared dependency of the
keypop-reader-java-apimodule on this new module.
New form of the deliverables: language-independent normative specifications
Until now, the Terminal APIs were described by a UML diagram and by the Javadoc of the Keypop Java modules. Each API now has a normative specification (
index.adoc), written in a notation independent of the implementation language (inspired by Kotlin), together with its class diagram. This new design proposal aims to broaden the choice of implementation languages for the Terminal APIs beyond Java, for example Kotlin Multiplatform (KMP), Rust, Swift or C#. This change of form affects the way types and operations are expressed; the consequences are described in Theme 10 (§11).
Reference documents
Each calypsonet-terminal-*-api-spec repository hosted on github.com/calypsonet contains, at its root:
- the normative specification
index.adoc; - the class diagram
uml/class-diagram.puml, whose content is strictly aligned with the specification.
| Module | Repository | Version |
|---|---|---|
| Terminal Reader API | calypsonet-terminal-reader-api-spec | 3.0.0-SNAPSHOT |
| Terminal Card API (internal) | calypsonet-terminal-card-api-spec | 3.0.0-SNAPSHOT |
| Terminal Calypso Card API | calypsonet-terminal-calypso-card-api-spec | 3.0.0-SNAPSHOT |
| Terminal Reader Definitions API (new) | calypsonet-terminal-reader-definitions-api-spec | 1.0.0-SNAPSHOT |
| Terminal Calypso Crypto Legacy SAM API | calypsonet-terminal-calypso-crypto-legacysam-api-spec | 2.0.0-SNAPSHOT |
| Terminal Calypso Crypto Symmetric API | calypsonet-terminal-calypso-crypto-symmetric-api-spec | 0.2.0-SNAPSHOT |
| Terminal Calypso Crypto Asymmetric API | calypsonet-terminal-calypso-crypto-asymmetric-api-spec | 0.3.0-SNAPSHOT |
| Terminal Generic Card API | calypsonet-terminal-genericcard-api-spec | 2.0.0-SNAPSHOT |
| Terminal Storage Card API | calypsonet-terminal-storagecard-api-spec | 2.0.0-SNAPSHOT |
The former diagrams published in the
…-SNAPSHOT/folders (api_class_diagram.svgandapi_class_diagram_diff.svg) reflect an intermediate state of the work and are no longer up to date; the reference is now theindex.adocspecification.
Diagram reading conventions:
- elements in blue are additions or modifications of the new version;
- elements in grey are under study (“work in progress”): they have never been implemented and are not part of the normative scope (see §21);
- green classes group data, constants, enumerations and errors;
- signatures follow the language-independent notation described in Theme 10 (
→ Self,T?,val property: Type = default, etc.).
Table of contents
- Overview
- Theme 1 — Support for multiple logical channels
- Theme 2 — Timing countermeasures: relay attack and card emulation
- Theme 3 — Simplified observation management
- Theme 4 — Knowledge of the current secure session state
- Theme 5 — Semantic improvements (renamings and removals)
- Theme 6 — Strict typing of RF technologies and card types (ECP support)
- Theme 7 — Command identification (
commandId) - Theme 8 — Standardised reader discovery and access (
CardReaderProvider) - Theme 9 — Redesign of the card selection model
- Theme 10 — Implementation-language-independent specification
- Theme 11 — Data exposed without computation and access to raw data
- Theme 12 — Stored Value (SV) operations
- Theme 13 — Tolerance of a missing file or record in a secure session
- Theme 14 — Crypto extensions and command interleaving
- Theme 15 — Validity of the Calypso HCE token
- Theme 16 — Card power and RF field
- Theme 17 — Card revocation
- Theme 18 — Transaction counter
- Normative clarifications
- Elements under study
- Migration procedure
- Next steps and validation by the TC Terminal
1. Overview
The new generation of the Terminal APIs introduces compatibility breaks on all existing APIs, creates a new foundation API (Terminal Reader Definitions API), and comes with a change of form of the deliverables (language-independent normative specifications). The changes are grouped into eighteen themes:
| # | Theme | Reader | Card | Calypso Card | Definitions | Legacy SAM | Crypto Sym. | Crypto Asym. | Generic Card | Storage Card |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Multiple logical channels | ● | ● | ● | — | — | — | — | ● | — |
| 2 | Relay and emulation countermeasures | — | ● | ● | — | — | — | — | ● | ● |
| 3 | Simplified observation | ● | — | — | — | — | — | — | — | — |
| 4 | Current secure session state | — | — | ● | — | — | — | — | — | — |
| 5 | Semantic improvements | ● | ● | ● | — | ● | ● | ● | ● | ● |
| 6 | RF / card type typing (ECP) | ● | — | — | ● (creation) | — | — | — | — | — |
| 7 | Command identification (commandId) | — | — | ● | — | ● | — | — | ● | ● |
| 8 | Standardised reader discovery | ● | — | — | — | — | — | — | — | — |
| 9 | Redesign of the selection model | ● | — | — | — | — | — | — | — | — |
| 10 | Language-independent specification | ● | ● | ● | ● | ● | ● | ● | ● | ● |
| 11 | Data without computation, raw data | — | ● | ● | — | ● | ● | ● | — | ● |
| 12 | Stored Value operations | — | — | ● | — | — | — | — | — | — |
| 13 | Missing file or record tolerated | — | — | ● | — | — | — | — | — | — |
| 14 | Crypto extensions and interleaving | — | — | ● | — | ● | — | — | — | — |
| 15 | Calypso HCE token validity | — | — | ● | — | — | — | — | — | — |
| 16 | Card power and RF field | ● | — | — | — | — | — | — | — | — |
| 17 | Card revocation | — | — | ● | — | — | — | — | — | — |
| 18 | Transaction counter | — | — | ● | — | — | — | — | — | — |
Cross-cutting consequences:
- Removal of the entire deprecated legacy: all elements marked
@Deprecatedin the production versions are removed with no compatibility alternative (for exampleChannelControlin the Calypso Card API,TransactionManager.processCommands()in the Legacy SAM API,prepareReadSystemBlock()in the Storage Card API). - Removal of the “work in progress” elements that appeared in the former diagrams for prospective purposes without ever being implemented:
ReaderApiFactory.createMultichannelCardSelector(),MultichannelCardSelector,CardSelectionResult.getCardReader()(Reader API);AsymmetricCryptoSecuritySetting.authorizeAllTrustedCa(),authorizeOnlyConfiguredCa()andrevokeCa(byte[])(Calypso Card API). The elements still under study in the Legacy SAM API are listed in §21. - Complete disappearance of
ChannelControl(Reader API, Card API, Calypso Card API): closing the channel becomes an explicit operation (closeChannel,transmitCardRequestAndCloseChannel,processCommandsAndCloseChannel). - Disappearance of duplicate errors: the
InvalidCardResponseExceptionof thereader.selectionpackage, as well as the communication and status errors specific to the Calypso Card API and the Legacy SAM API, disappear in favour of the Reader API errors. - Recursive genericity dropped: all interfaces of the form
T extends X<T>(transaction managers, selectors, signature data) lose their type parameter; fluent chaining is expressed by theSelfreturn type (see Theme 10).
2. Theme 1 — Support for multiple logical channels
2.1 Motivation
Until now, the API implicitly assumed that only one logical channel was open at a time between the terminal and the card. Version 3.0.0 explicitly introduces the notion of multiple logical channels (ISO cards supporting several simultaneous application selections on distinct logical channels), with two objectives:
- to allow several applications of the same card to be selected and handled in parallel;
- to clearly distinguish, for each smart card, on which channel it is attached and whether it is still active.
The concrete trigger for this work is the arrival of a new CNA product, OpenSAM, whose usage model relies on the simultaneous coexistence of several security applications accessible in parallel on distinct logical channels. The detailed specifications of OpenSAM are covered by the CNA documentation dedicated to this product.
2.2 Reader API
Multi-channel selection
- New manager
MultichannelCardSelectionManager, obtained throughReaderApiFactory.createMultichannelCardSelectionManager(), whose operationprocessCardSelectionScenario(reader: CardReader, channelSelectionPolicy: ChannelSelectionPolicy) → MultichannelCardSelectionResultexecutes the scenario by placing each successful selection on its own logical channel. If the presented card does not support multi-channel, anInvalidCardResponseerror is raised at scenario execution time. This manager is part of the overall redesign of the selection described in Theme 9 (§10). - New enumeration
ChannelSelectionPolicy:ALLOW_BASIC_CHANNEL— allows the use of the basic channel (channel 0) in addition to the additional logical channels;LOGICAL_CHANNEL_ONLY— restricts the selection to the additional logical channels (channel 0 is not used).
- New result
MultichannelCardSelectionResult(cardType,smartCards): all the cards it exposes are active in parallel, each on its own channel. The scheduled mode (selection on card insertion) is not offered in multi-channel mode.
Channel knowledge at card level
- New operation
SmartCard.isActive() → Boolean— the card knows whether it is still active on its channel. - New operation
IsoSmartCard.isBasicChannel() → Boolean— indicates whether the card is attached to the basic channel or to an additional logical channel.
Multi-channel transaction management
The hierarchy of transaction managers (namespace reader.transaction.spi) is restructured into three levels:
CardTransactionManager (root interface, non-generic)
├─ IsoCardTransactionManager (new, ISO 7816-4 — carries the conversion to multi-channel)
└─ MultichannelCardTransactionManager (new, actual multi-channel)
CardTransactionManager(redesigned) — no longer generic; exposesprocessCommands() → Unit(without parameter). It is the common root interface of all transaction managers.IsoCardTransactionManager— new intermediate interface dedicated to ISO 7816-4 cards. It exposes a single operationasMultichannelCardTransactionManager() → MultichannelCardTransactionManager, which returns a multi-channel view of the manager. The conversion itself never fails: if the underlying card does not support multi-channel, theInvalidCardResponseerror is only raised when the commands are processed by the obtained manager (processCommands,processCommandsAndCloseChannel).MultichannelCardTransactionManager— new interface extendingCardTransactionManager; exposes:processCommandsAndCloseChannel() → Unit— processes the pending commands and, upon success, closes the channel;closeChannel() → Unit— explicit, idempotent closing of the channel.
Expected anchoring on the consumer API side:
- APIs targeting ISO 7816-4 cards that are not intrinsically multi-channel (Calypso Card, Generic Card) make their transaction manager extend
IsoCardTransactionManagerand access multi-channel on demand throughasMultichannelCardTransactionManager().- APIs targeting intrinsically multi-channel cards (the future Terminal OpenSAM API in particular) make their transaction manager extend
MultichannelCardTransactionManagerdirectly.
2.3 Card API
- New operation
SmartCardSpi.deactivate() → Unit— allows the reader to deactivate the card, so that the application immediately seesSmartCard.isActive()switch tofalse. - New SPI interfaces
IsoSmartCardSpi(extendsSmartCardSpi, marker) andMultichannelSmartCardSpi(extendsIsoSmartCardSpi) withgetChannel() → Int— multi-channel being a specialisation of ISO/IEC 7816-4, only an ISO selection extension can produce such a smart card (see Theme 9). - Redesign of
ProxyReaderApi:- removed:
transmitCardRequest(CardRequestSpi, ChannelControl)andreleaseChannel(); - added:
transmitCardRequest(cardRequest: CardRequest, smartCard: SmartCardSpi) → CardResponse;transmitCardRequestAndCloseChannel(cardRequest: CardRequest, multichannelSmartCard: MultichannelSmartCardSpi) → CardResponse;closeChannel(multichannelSmartCard: MultichannelSmartCardSpi) → Unit.
- removed:
- Addition of the property
CardSelectionResponse.channel: Int— the selection response carries the channel number (0in single-channel mode). - Removal of
CardResponseApi.isLogicalChannelOpen()— made redundant by the new model.
2.3.1 Role of the card passed to the ProxyReaderApi
The SmartCardSpi / MultichannelSmartCardSpi parameter is not a mere vehicle for the channel number. It plays up to three roles:
- carrying the logical channel number (with
MultichannelSmartCardSpionly); - carrying the active state of the card, so that the reader checks that it is still active before any transmission — an inactive card causes the
CardBrokenCommunicationerror; - allowing the reader to deactivate the card (
SmartCardSpi.deactivate()), for example after a communication error or on explicit channel closure.
2.3.2 SmartCard lifecycle
The reader keeps the references to the SmartCard instances resulting from the last selection and deactivates them in four cases:
- on a new selection in single-channel mode;
- on an explicit channel closure request (
closeChannel,processCommandsAndCloseChannel); - on the call to
CardReader.endCardProcessing(); - on an error indicating that the card can no longer be reached (
CardCommunication,ReaderCommunication).
This contract, which only appeared as prose in the previous version of this document, is now normative: it is defined in the Reader API specification (description of SmartCard.isActive, SmartCard lifecycle section).
2.4 Calypso Card API
- The Calypso
TransactionManagernow extendsIsoCardTransactionManager(instead ofCardTransactionManager). Multi-channel access is performed without a dedicated operation: the integrator callsasMultichannelCardTransactionManager()and then usesprocessCommandsAndCloseChannel()/closeChannel().
2.5 Generic Card API
- The transaction manager (renamed
GenericCardTransactionManager, see Theme 5) now extendsIsoCardTransactionManager.
2.6 Rationale
“By parameter” control (ChannelControl.KEEP_OPEN / CLOSE_AFTER) relied on an implicit, global notion of a “single current channel”. In a multi-channel context, this model is ambiguous: which channel does CLOSE_AFTER apply to? Moving to a model where the target (the SmartCard(Spi)) is explicitly named in each call removes this ambiguity.
The three-level hierarchy allows each consumer API to anchor itself at the capability level that exactly matches its card model: on-demand conversion for cards for which multi-channel is only an optional capability, direct anchoring for intrinsically multi-channel cards.
3. Theme 2 — Timing countermeasures: relay attack and card emulation
3.1 Motivation
Two threats are detected through the duration of the exchanges, and the new versions introduce a single mechanism for both.
- A relay attack consists in relaying the dialogue with a card to a remote location, which makes a fraudulent operation possible without the cardholder’s knowledge. The relay adds a transmission delay: an abnormally long exchange can therefore reveal that the card is not actually present in front of the reader.
- Card emulation consists in having a generic RFID device answer in place of the expected card. Such a device processes the command in software, where the chip answers in hardware: an abnormally long exchange then reveals that the answer does not come from the expected product. This threat mainly concerns storage cards, which have no cryptographic mechanism. The new versions introduce a mechanism for measuring and bounding APDU exchange durations and for bounding the secure session duration.
Threat model
- Targeted attack surface: application-level attack (software relay of APDUs, card emulation by a generic device), as opposed to attacks at the physical RF transport level, which are covered by hardware countermeasures.
- Units: every duration carries the suffix of its unit, and the microsecond (
...Us) is the unit of the whole family — Card API, Generic Card API and Storage Card API — as well as the unit of the measurement. The effective resolution of the measurement depends on the implementation, which must document it. - Measurement location: the Terminal Reader API implementation measures the effective duration of each APDU exchange and compares it with the bound declared on the request. In a Calypso transaction the bounded exchanges are Open Secure Session, Close Secure Session and SV Reload / SV Debit / SV Undebit, each bound covering a single command exchange; the bounds themselves are resolved by the Calypso card extension, not by the application (see §3.3).
- Behaviour after an overrun: the Card API raises the
ApduExchangeDurationExceedederror, which the higher-level extensions intercept and propagate to the application as anInvalidCardResponse. The Calypso Card API now specifies this behaviour: if a secure session is open, it is automatically cancelled before the error is propagated, so that no modification performed during the session is validated by the card; outside a session (SV command), there is nothing to cancel and only the error is propagated to the ticketing layer, which decides what to do according to its own context. In the Generic Card API, an overrun raisesInvalidCardResponse, whose message identifies the offending command.
3.2 Card API
- Request side:
ApduRequest.apduExchangeMaxDurationUs: Long? = null— maximum tolerated duration for the exchange (in microseconds);nullmeans “no bound”. - Response side:
ApduResponse.apduExchangeDurationUs: Long?— effective duration of the exchange;nullmeans “duration not measured”. - New error
ApduExchangeDurationExceeded— raised byProxyReaderApi.transmitCardRequest(...)when the effective duration exceeds the declared bound. Like the other APDU errors, it carriescardResponseandisCardResponseComplete. - The Card API specification now documents this mechanism as a practical solution for implementing anti-relay countermeasures (APDU exchange execution-time control chapter). It also states who sets the bound: it is not a value an application can know, and is chosen by the card extension from a configuration it obtains by its own means (see §3.3).
3.3 Calypso Card API
No operation. The specification exposes nothing for configuring the countermeasure: it is entirely handled by the implementation, which obtains its configuration by its own means, outside the surface of the API — as a reader driver obtains its technical parameters when it is instantiated.
The reason is that a usable bound is the sum of two budgets held by two different parties: the computation time of the card, which depends on its product type and on the key used, and the latency of the terminal — coupler, antenna, driver, execution platform. Neither is known to the ticketing application, and the calibration that establishes them is performed against the very implementation that will be deployed, which makes the content of that configuration an internal matter.
The Command exchange duration bounds section is therefore addressed to the implementer. It states:
- the bounded command exchanges — Open Secure Session, Close Secure Session, and SV Reload / SV Debit / SV Undebit (symmetric-key transactions only). Each bound covers a single command exchange, from the transmission of the command to the reception of its response; the other commands of the session or of the SV operation are not counted. Those other commands are not bounded, and an implementation should not bound them: their duration varies with the volume of data exchanged, so a bound would yield false positives without adding protection.
- the mechanism — the Card API provides a maximum duration declared on each request (
ApduRequest.apduExchangeMaxDurationUs, enforced by the reader throughApduExchangeDurationExceeded) and the effective duration measured on each response (ApduResponse.apduExchangeDurationUs). Two ways of applying a bound follow, which are not equivalent: declared on the request, resolved before the exchange and enforced by the reader; or checked on the response, resolved after the exchange — the only way for a bound to depend on what the exchange itself reveals, typically the KIF and KVC returned by Open Secure Session, which identify the key, and therefore the computation time, of the card that has just answered. - non-silence — an implementation must not let a transaction pass for a protected one when the countermeasure could not be applied: when no measurement is available, it reports that condition by its own means instead of remaining silent.
- the behaviour on overrun, unchanged: an open secure session is automatically cancelled before the error is propagated as an
InvalidCardResponse; outside a session (SV command), there is nothing to cancel and only the error is propagated.
What the ticketing application sees: it configures nothing and is not told whether a bound applies.
InvalidCardResponsemay arise from a duration overrun as well as from a malformed response — an application that already handles that error needs no change. Absent a configuration, no bound applies and no protection exists.
Dropped from the working versions of this document: the six assign…MaxDuration…ByCsn/ByFci(...) operations, together with everything they required — the CSN threshold and FCI regular-expression criteria, the portable regex subset, the two-stage resolution rule, the Long.MAX_VALUE sentinel, the duplicate-declaration rules and the FCI integrity caveat. The Calypso Card API no longer declares any duration, which is why it no longer departs from the microsecond.
3.4 Generic Card API
GenericCardTransactionManager.prepareCommandWithMaxDuration(commandId: Int, apdu: ByteArray, maxDurationUs: Long) → Self— prepares a command with an identifier (see Theme 7) and a duration bound. If the effective duration exceeds the bound, theInvalidCardResponseerror identifies the offending command.
The Generic Card API thus exposes the relay countermeasure at the level of each individual command, consistent with its usage model (APDU sequences without an explicit secure transaction).
3.5 Storage Card API
- New data class
StorageCardSecuritySettings(storagecard.transaction), with the propertyreadCommandMaxDurationsUs: Map<StorageCardProductType, Long> = emptyMap(): maximum duration, in microseconds, of the exchange of a single read command, for each product type. A product type that is absent is not bounded. One instance may be shared by every transaction of a terminal. - Factory operation changed:
createStorageCardTransactionManager(reader, card, securitySettings) → StorageCardTransactionManager. A defaultStorageCardSecuritySettingsdisables every duration bound. - Scope: the bound applies to the read commands prepared on the transaction manager (
prepareReadBlock,prepareReadBlocks,prepareSt25ReadSystemBlock); it applies neither to the selection, nor to the write and authentication commands. An overrun raisesStorageCardInvalidCardResponse, which already carriesblockAddressandcommandId.
Targeted threat: for storage cards, the threat is not the relay but card emulation by a generic RFID device, which does not answer a read command in the same time as the chip of the expected product.
Storage cards have neither an FCI nor a secure session: the product type is enough to segment the fleet, where the Calypso Card API uses the CSN and the FCI.
3.6 Rationale
Both the relay and the emulation introduce a significant and systematic timing deviation on APDU exchanges; monitoring this deviation at the reader level (Card API), on the bounded commands of a Calypso transaction (Calypso Card API), on each generic command (Generic Card API) and on each storage card read (Storage Card API) covers all the usage scenarios of the Terminal APIs.
4. Theme 3 — Simplified observation management
4.1 Motivation
The production model exposed a complete Observer pattern (addObserver, removeObserver, clearObservers, countObservers, setReaderObservationExceptionHandler) plus two distinct SPIs (CardReaderObserverSpi and CardReaderObservationExceptionHandlerSpi). In practice, a single observer is registered, and the separation between event handler and error handler brought no value.
4.2 Reader API — ObservableCardReader
Removed operations:
setReaderObservationExceptionHandler(CardReaderObservationExceptionHandlerSpi)addObserver(CardReaderObserverSpi),removeObserver(CardReaderObserverSpi),clearObservers(),countObservers()startCardDetection(DetectionMode)(single-argument signature)finalizeCardProcessing()(renamed, see below)
Added / redesigned operations:
startCardDetection(settings: CardDetectionSettings, eventHandler: CardReaderEventHandler) → Unit— the handler is registered when detection starts, in a single operation, together with the detection settings (see Theme 6).endCardProcessing() → Unit— replacesfinalizeCardProcessing(); idempotent; additionally releases the references to theSmartCardinstances of the last selection, and is now carried byCardReaderso that a non-observable reader can also close the dialogue with the card (see Theme 16 and §2.3.2).clearScheduledCardSelectionScenario() → Unit— new operation that removes the card selection scenario scheduled on the reader. From the next insertion onwards, no scenario is executed andCardReaderEvent.scheduledCardSelectionsResponseisnull. Idempotent.
Removed SPIs: CardReaderObserverSpi, CardReaderObservationExceptionHandlerSpi.
Added SPI: CardReaderEventHandler, which merges the two previous SPIs:
onReaderEvent(cardReaderEvent: CardReaderEvent) → Unit;onReaderError(context: String, readerName: String, error: Any) → Unit.
4.3 Rationale
This simplification:
- reduces the API surface (5 operations and 2 SPIs become 1 operation and 1 SPI);
- eliminates invalid states (observer registered without an error handler, detection started without an observer, etc.);
- aligns the API with the actual usage observed among integrators.
5. Theme 4 — Knowledge of the current secure session state
5.1 Motivation
On the Calypso side, the application had no direct means of knowing whether a secure session was open, nor its nature (symmetric / asymmetric) or its write access level.
5.2 Calypso Card API
- New operation
TransactionManager.getSecureSessionState() → SecureSessionState— returns the state of the secure session at the moment of the call. - New enumeration
SecureSessionState:NO_SESSION— no secure session is open: none has been opened yet, or the last one has been closed or cancelled;ASYMMETRIC— PKI session;SYMMETRIC_PERSONALIZATION,SYMMETRIC_LOAD,SYMMETRIC_DEBIT— symmetric session opened with the corresponding write access level.
Change compared with the previous working version of this document: the
SecureSessionStatusobject (withisOpen,type,writeAccessLevel) /SecureSessionTypepair is replaced by a single enumeration. The former form lefttypeandwriteAccessLevelundefined when no session was open; the enumeration makes these combinations impossible. The name State (rather than Status) designates one state among mutually exclusive states and avoids any confusion with the status data returned by the card (status word,dfStatus, etc.).
Chosen granularity: the values reflect the cryptographic nature of the session and not the application mode (Regular / Extended); the latter is deduced from the sub-type of the instantiated
TransactionManager.
5.3 Rationale
The Calypso TransactionManager can now be introspected about its own secure session, which spares the caller from maintaining its own state tracking.
6. Theme 5 — Semantic improvements (renamings and removals)
This theme groups the renamings and removals motivated by clarity or consistency. The changes resulting from the language-independent notation (Exception, Spi, Api suffixes, nested enumerations, overloads) are described in Theme 10; the exhaustive list is given in Annex A.
6.1 Reader API
| Before (Java 2.1.0) | After (3.0.0) | Rationale |
|---|---|---|
ObservableCardReader.DetectionMode.SINGLESHOT | DetectionMode.SINGLE_SHOT | UPPER_SNAKE_CASE convention (compound word). |
CardReaderEvent.Type.UNAVAILABLE | CardReaderEventType.READER_UNREGISTERED | The name describes the actual cause of the event. |
ObservableCardReader.NotificationMode | CardPresenceNotificationPolicy (namespace reader.selection) | The name describes what is notified; the notion belongs to selection. |
ObservableCardReader.finalizeCardProcessing() | CardReader.endCardProcessing() | finalize is loaded in Java (method of Object, deprecated by the JDK); the operation also moves up to CardReader (see Theme 16). |
Removals:
CardSelectionManager.setMultipleSelectionMode()andprepareReleaseChannel()— see Themes 1 and 9;ChannelControlandCardTransactionManager.processCommands(ChannelControl)— replaced byprocessCommands();ReaderProtocolNotSupportedException— disappears withConfigurableCardReader(see Theme 6);reader.selection.InvalidCardResponseException— duplicate of the error of the same name in thereadernamespace.
6.2 Card API
- Removal of
ChannelControl, ofProxyReaderApi.releaseChannel()and ofCardResponseApi.isLogicalChannelOpen()(see Theme 1). - Removal of the abstract error
AbstractApduException: its information (cardResponse,isCardResponseComplete) is carried directly by the four errors concerned (ReaderBrokenCommunication,CardBrokenCommunication,UnexpectedStatusWord,ApduExchangeDurationExceeded).
6.3 Calypso Card API
- Removals:
TransactionManager.processCommands(ChannelControl)andChannelControl(deprecated);- the errors
UnexpectedCommandStatusException,ReaderIOException,CardIOException(deprecated), covered byInvalidCardResponse,ReaderCommunicationandCardCommunicationof the Reader API; - the
SelectFileExceptionerror, which has become pointless (see Theme 13); CalypsoCardApiFactory.createSearchCommandData()(see Theme 11).
- Renaming of overloaded operations (see Theme 10):
prepareSelectFile(short)→prepareSelectFileByLid,prepareSelectFile(SelectFileControl)→prepareSelectFileByControl(parameter harmonised asselectFileControl), inCalypsoCardSelectionExtensionandTransactionManager. - Nested enumerations renamed:
CalypsoCard.ProductType→CalypsoCardProductType,ElementaryFile.Type→ElementaryFileType. - Collections named in the plural: the
counterNumberToDecValueMap/counterNumberToIncValueMapparameters ofprepareDecreaseCounters/prepareIncreaseCountersbecomedecrementValues/incrementValues; thekif/kvcproperties ofDirectoryHeaderbecomekifByAccessLevel/kvcByAccessLevel. - Security settings renamed to the plural:
SymmetricCryptoSecuritySetting→SymmetricCryptoSecuritySettings,AsymmetricCryptoSecuritySetting→AsymmetricCryptoSecuritySettings; the factory operations follow (createSymmetricCryptoSecuritySettings,createAsymmetricCryptoSecuritySettings), as does thesecuritySettingsparameter of thecreateSecure…TransactionManageroperations.
6.4 Legacy SAM API
- Removals:
TransactionManager.processCommands()(deprecated) andprocessCommands(ChannelControl): the manager now inheritsCardTransactionManager.processCommands()from the Reader API;- the errors
UnexpectedCommandStatusException,ReaderIOException,SamIOException, covered by the Reader API errors; LegacySamRevocationServiceSpi.isSamRevoked(serialNumber)(variant without counter value): onlyisSamRevoked(serialNumber: ByteArray, counterValue: Int) → Booleanremains.
- Renaming of overloaded operations (see Theme 10):
| Before (Java 1.0.0) | After (2.0.0) |
|---|---|
setUnlockData(String, LegacySam.ProductType) | setUnlockDataForProductType(unlockData, productType) |
setStaticUnlockDataProvider(provider) | setStaticUnlockDataProviderWithDeferredReader(provider) |
setStaticUnlockDataProvider(provider, targetSamReader) | setStaticUnlockDataProvider(provider, targetSamReader) (nominal case, name unchanged) |
setDynamicUnlockDataProvider(provider) | setDynamicUnlockDataProviderWithDeferredReader(provider) |
setDynamicUnlockDataProvider(provider, targetSamReader) | setDynamicUnlockDataProvider(provider, targetSamReader) (nominal case, name unchanged) |
prepareReadWorkKeyParameters(int) / (byte, byte) | prepareReadWorkKeyParametersByRecordNumber / prepareReadWorkKeyParametersByKifKvc |
getWorkKeyParameter(int) / (byte, byte) | getWorkKeyParametersByRecordNumber / getWorkKeyParametersByKifKvc |
prepareTransferWorkKeyDiversified(…, diversifier) | prepareTransferWorkKeyDiversifiedWithSpecificDiversifier(…, diversifier) |
LegacySam.ProductType | LegacySamProductType |
6.5 Generic Card API
| Before (Java 1.0.0) | After (2.0.0) | Rationale |
|---|---|---|
CardTransactionManager | GenericCardTransactionManager | Name specific to the API, with no collision with the Reader API CardTransactionManager it inherits from. |
GenericCardApiFactory.createCardTransaction(reader, card) | createGenericCardTransactionManager(reader, card) | The name designates the created object. |
prepareApdu(String) | (removed) | Conversion from a string is left to the application. |
prepareApdu(byte[]) | prepareCommand(apdu: ByteArray) | “Command”-oriented name. |
prepareApdu(byte cla, byte ins, byte p1, byte p2, byte[] dataIn, Byte le) | (removed) | Building APDUs field by field is left to the application. |
getResponsesAsByteArrays() | getLastExecutionResponses() → List<ByteArray> | Specifies the time scope (last execution). |
getResponsesAsHexStrings() | (removed) | The hexadecimal representation is left to the application. |
New operations related to Themes 2 and 7: prepareCommandWithId, prepareCommandWithMaxDuration, getLastExecutionResponse (see §8.2).
6.6 Storage Card API
| Before (Java 1.2.0) | After (2.0.0) | Rationale |
|---|---|---|
ProductType (namespace storagecard.card) | StorageCardProductType | Name specific to the API, unambiguous with respect to the other product types of the family. |
ProductType.getBlockCount(), getBlockSize(), hasSystemBlock(), hasWriteAcknowledgment(), hasAuthentication() | properties blockCount, blockSize, hasSystemBlock, hasWriteAcknowledgment, hasAuthentication of the enumeration | These are data specific to each product, exposed as such (see Theme 10). |
StorageCard.getUID() | StorageCard.getUid() | lowerCamelCase convention for acronyms. |
prepareMifareClassicAuthenticate(…, byte[] key) | prepareMifareClassicAuthenticateWithKey(…, key) | Unique operation names (see Theme 10). |
prepareMifareClassicAuthenticate(…, int keyNumber) | prepareMifareClassicAuthenticateWithKeyNumber(…, keyNumber) | (same) |
StorageCardTransactionManager.prepareReadSystemBlock(), prepareWriteSystemBlock(byte[]) (deprecated) | (removed); prepareSt25ReadSystemBlock() and prepareSt25WriteSystemBlock(commandId, data) remain | The St25 prefix reflects the product-specific nature of the system block. |
StorageCardException interface (getBlockAddress()) | (removed); the errors carry blockAddress: Int? and commandId: Int? | The information is carried directly by each error. |
SCAuthenticationFailedException extends CardCommunicationException | StorageCardAuthenticationFailed (no parent error) | An authentication failure is not a communication error. |
In addition, StorageCard.getBlock, getBlocks and getSystemBlock now explicitly return ByteArray? (null if the data has not been read).
6.7 Crypto Symmetric and Crypto Asymmetric APIs
The evolutions of these two APIs relate to Themes 10 and 11 (data objects, removal of input/output objects); they are detailed in §11 and §12 and in Annex A.
7. Theme 6 — Strict typing of RF technologies and card types (ECP support)
7.1 Motivation
Two drivers converge:
- End of free-form strings for protocols. The production versions configured protocol activation and selection filtering with character strings (
physicalProtocolName,logicalProtocolName): non-standardised values, undetected typos, scattered documentation. - Arrival of ECP support (Enhanced Contactless Polling), a mechanism defined by the Apple ECP specification that allows fast detection of cards (notably Calypso) in transit mode on iPhone, and requires sending a specific polling frame when detection starts. The frame is handled as opaque binary data built by the application.
7.2 New foundation API — Terminal Reader Definitions API
The RfTechnology and CardType enumerations are placed in a new foundation API, the Terminal Reader Definitions API, which exposes neither service interface nor SPI; its only purpose is to host the cross-cutting enumerated types shared between Terminal APIs.
Structural consequences
- New repository:
calypsonet-terminal-reader-definitions-api-spec(version1.0.0-SNAPSHOT). - New Keypop Java module:
keypop-reader-definitions-jvm-api(to be created). - Public and transitive dependency of the Terminal Reader API on the Terminal Reader Definitions API (the enumerations appear in the properties
BasicCardSelector.cardType,IsoCardSelector.cardType,CardDetectionSettings.rfTechnologiesand…CardSelectionResult.cardType).
Initial content
ReaderDefinitionsApiProperties—VERSIONconstant of the module;RfTechnology:ISO_14443_AB,INNOVATRON_B_PRIME,FELICA,ISO_15693;CardType:ISO_7816_3,ISO_14443_4,ISO_14443_3A_MIFARE_CLASSIC_1K,ISO_14443_3A_MIFARE_CLASSIC_4K,ISO_14443_3A_MIFARE_ULTRALIGHT,ISO_14443_3B_ST25_SRT512,INNOVATRON_B_PRIME,FELICA,ISO_15693,UNKNOWN.
CardTypegranularity and A/B asymmetry withRfTechnology:RfTechnologyis an input (polling) that merges A and B at the ISO 14443 level;CardTypeis an output that combines protocol level and product identity — a singleISO_14443_4value for the transport, but a product granularity (ISO_14443_3A_…,ISO_14443_3B_…) for proprietary products.
CardType.UNKNOWNis returned when the card type could not be identified; used as a selection filter, it allows these cards to be captured explicitly.
7.3 Reader API — strict typing
- Removed:
CardSelector.filterByCardProtocol(String logicalProtocolName). - Added: the
cardType: CardType? = nullproperty of theBasicCardSelectorandIsoCardSelectorselectors — filters by card type (nulldisables the filter). - Removed entirely: the
ConfigurableCardReaderinterface and its operationsactivateProtocol(String, String),deactivateProtocol(String),getCurrentProtocol().
7.4 Reader API — detection settings
All detection information is grouped in the data class CardDetectionSettings, built directly by the application:
| Property | Type | Default value | Role |
|---|---|---|---|
detectionMode | DetectionMode | DetectionMode.REPEATING | whether detection resumes after each card processing |
rfTechnologies | Set<RfTechnology> | setOf(RfTechnology.ISO_14443_AB) | RF technologies activated during polling (no effect on a contact reader) |
ecpFrame | ByteArray? | null | ECP frame emitted when polling starts (ECP readers only) |
DetectionModebecomes a top-level enumeration of thereadernamespace (it was nested inObservableCardReader).- Tolerance of unsupported settings: a setting not supported by the reader (RF technology, ECP frame) is silently ignored and a
WARN-level message is typically logged; no error is raised.
Change compared with the previous working version of this document:
CardDetectionSettingsis no longer a “builder” interface obtained throughReaderApiFactory.createCardDetectionSettings(), but a data class with default values (see Theme 10).
7.5 Reader API — ObservableCardReader and selection result
startCardDetection(settings: CardDetectionSettings, eventHandler: CardReaderEventHandler) → Unitcarries the event handler and the detection configuration in a single call.- The detected card type is exposed by the
cardType: CardTypeproperty of the selection results (SingleCardSelectionResult,SequentialCardSelectionResult,MultichannelCardSelectionResult, see Theme 9);UNKNOWNif the type could not be identified.
7.6 Rationale
- Compile-time safety for values: moving from strings to enumerations eliminates a class of bugs and makes the API self-describing.
- Simplicity: a single
ObservableCardReader, a single detection settings class. - Extensibility: adding a polling setting amounts to adding a property with a default value to
CardDetectionSettings, without touching thestartCardDetectionsignature. - Input / output separation:
RfTechnologyas input (polling),CardTypeas output (result) and as a selection criterion. - Single, typed declaration: in production, the protocol had to be declared twice (
activateProtocolon the reader side,filterByCardProtocolon the selector side); it is now declared only once, in a typed way. - Cross-cutting reusability thanks to the extraction of the enumerations into the Terminal Reader Definitions API.
8. Theme 7 — Command identification (commandId)
8.1 Motivation
Several APIs allow several commands to be prepared before executing them as a batch. In production, the application had no direct means of identifying which command caused a problem, nor of accessing the result of a specific command; some APIs relied on mutable container objects for this purpose (KeyPairContainer, SearchCommandData.getMatchingRecordNumbers(), SignatureComputationData.getSignature(), etc.).
The new versions generalise a single mechanism: an integer identifier commandId supplied by the application when preparing the command, then used to retrieve the result of the command or to identify the failing command. The commandId parameter, always placed first, follows the same convention as selectionCaseId in the Reader API (see Theme 9).
The name
commandIdreplacesidCommandfrom the previous working version of this document, for consistency withselectionCaseId.
8.2 Generic Card API
prepareCommandWithId(commandId: Int, apdu: ByteArray) → Self;prepareCommandWithMaxDuration(commandId: Int, apdu: ByteArray, maxDurationUs: Long) → Self(see Theme 2);getLastExecutionResponse(commandId: Int) → ByteArray?— response of the identified command; if several commands share the same identifier, the most recently processed one is returned.prepareCommand(apdu: ByteArray) → Selfremains available for unidentified commands.
8.3 Storage Card API
prepareWriteBlocks(commandId: Int, fromBlockAddress: Int, data: ByteArray) → Self;prepareSt25WriteSystemBlock(commandId: Int, data: ByteArray) → Self.
For these two write operations, commandId is mandatory (non-nullable). It is returned by the commandId: Int? property of the Storage Card API errors when the identified command caused them (null for commands that carry none, such as reads).
8.4 Calypso Card API
prepareSearchRecords(commandId: Int, data: SearchCommandData) → Self;CalypsoCard.getMatchingRecordNumbers(commandId: Int) → List<Int>?— numbers of the records found by the identified search. This operation replacesSearchCommandData.getMatchingRecordNumbers()(see Theme 11).
8.5 Legacy SAM API
The results of the cryptographic commands are no longer read from container objects but from the LegacySam, by identifier:
| Preparation | Reading the result |
|---|---|
FreeTransactionManager.prepareGenerateCardAsymmetricKeyPair(commandId: Int) | LegacySam.getKeyPair(commandId: Int) → ByteArray? |
FreeTransactionManager.prepareComputeCardCertificate(commandId: Int, data: LegacyCardCertificateComputationData) | LegacySam.getComputedCardCertificate(commandId: Int) → ByteArray? |
prepareComputeSignature(commandId: Int, data: SignatureComputationData) (on FreeTransactionManager and CardTransactionLegacySamExtension) | LegacySam.getSignature(commandId: Int) → ByteArray? and, in traceable mode, LegacySam.getSignedData(commandId: Int) → ByteArray? |
prepareVerifySignature(commandId: Int, data: SignatureVerificationData) (same) | LegacySam.isSignatureValid(commandId: Int) → Boolean? |
These reads replace KeyPairContainer.getKeyPair(), LegacyCardCertificateComputationData.getCertificate(), SignatureComputationData.getSignature(), TraceableSignatureComputationData.getSignedData() and SignatureVerificationData.isSignatureValid().
8.6 Rationale
- Application semantics: the identifier is chosen by the application, which can align it with its own business logic.
- Immutable data objects: the parameters of a command become pure data (see Theme 10); the result is carried by the live object that receives the responses (
CalypsoCard,LegacySam, transaction manager), like all the other data coming from the card. - Cross-API consistency: the same pattern (identifier first, read by identifier) applies to all the APIs concerned.
9. Theme 8 — Standardised reader discovery and access (CardReaderProvider)
9.1 Motivation
In production, the Reader API exposed no standard means of discovering the available readers or of obtaining a reference to a reader. The application had to rely on the plugin and pool abstractions of the underlying Keyple framework, which are implementation-specific and not portable.
9.2 Reader API
- New operation
ReaderApiFactory.getCardReaderProvider() → CardReaderProvider— returns theCardReaderProviderof the execution environment; successive calls return the same instance. - New interface
CardReaderProvider:getReaderNames() → Set<String>;getReaders() → Set<CardReader>;getReader(readerName: String) → CardReader?— exact name match,nullif no reader matches;findReader(readerNameRegex: String) → CardReader?— first reader whose name matches the regular expression,nullotherwise.
The reader lifecycle remains driven by the execution environment; CardReaderProvider is a read-only view of the readers active at each call.
9.3 Rationale
- Decoupling from Keyple implementation concepts: the application only knows the Reader API.
- First-class citizen of the public API for a universal need.
- Two complementary search modes: exact name and regular expression.
10. Theme 9 — Redesign of the card selection model
10.1 Motivation
In production, the CardSelectionManager gathered all selection modes, driven by a side effect (setMultipleSelectionMode()), and returned a single CardSelectionResult in which some properties could be deduced from others (getActiveSmartCard() and getActiveSelectionIndex() from getSmartCards()). Adding multi-channel made this single result ambiguous (which card is “the” active card when several are active?). The previous working version of this document proposed a SelectionExecutionPolicy parameter; this approach has been abandoned in favour of one manager type per selection mode.
10.2 Reader API — one manager per mode
The selection mode is no longer a parameter: it is carried by the type of the manager, each obtained through its own factory operation and producing its own result type.
| Manager | Behaviour | Execution | Result |
|---|---|---|---|
SingleCardSelectionManager | single-channel; stops at the first matching case: the first card application, or the card itself when it hosts no application (storage card) | explicit or scheduled | SingleCardSelectionResult |
SequentialCardSelectionManager | single-channel; selects in turn every matching application of the card, only the last one remaining active; not applicable to storage cards | explicit or scheduled | SequentialCardSelectionResult |
MultichannelCardSelectionManager | multi-channel ISO 7816-4 cards; every matching application stays active simultaneously, each on its own logical channel; out of scope for storage cards | explicit | MultichannelCardSelectionResult |
TC remark (Stéphane): the scenarios discriminate the applications of a single physical card; the API keeps the term card because a selection case also targets cards without any application, such as storage cards. This is now made explicit in the specification, in the
CardSelectionManagersection.
Compared with the previous working version of this document,
MultipleCardSelectionManageris renamedSequentialCardSelectionManager(as are its result and its factory operation): the qualifier describes the scenario execution mode, not a number of cards. Likewise,prepareSelectionbecomesprepareIsoSelectionCaseorprepareBasicSelectionCase, depending on the family of the selector, andselectionIdbecomesselectionCaseId.
- Factory:
createCardSelectionManager()is replaced bycreateSingleCardSelectionManager(),createSequentialCardSelectionManager()andcreateMultichannelCardSelectionManager(). CardSelectionManagerbecomes the common interface and only keeps the mode-independent operations:prepareIsoSelectionCase(selectionCaseId: Int, cardSelector: IsoCardSelector, cardSelectionExtension: IsoCardSelectionExtension) → Self— the selection identifier is chosen by the application (instead of an index returned by the API); it must be unique within the scenario; selections are executed in preparation order;exportCardSelectionScenario() → String;importCardSelectionScenario(cardSelectionScenario: String) → Self— replaces the current scenario (instead of returning the index of the last imported selection);exportProcessedCardSelectionScenario() → String.
- Operations specific to each manager (typed by their result):
processCardSelectionScenario,scheduleCardSelectionScenario,parseScheduledCardSelectionsResponseandprepareBasicSelectionCase(single-channel only),importProcessedCardSelectionScenario(the imported processed scenario must come from a manager of the same type). scheduleCardSelectionScenario(observableCardReader: ObservableCardReader, cardPresenceNotificationPolicy: CardPresenceNotificationPolicy) → Unitno longer has an execution policy parameter.
Selection results
| Result | Properties |
|---|---|
SingleCardSelectionResult | cardType: CardType, selectionCaseId: Int?, smartCard: SmartCard? (both null if no selection succeeded) |
SequentialCardSelectionResult | cardType: CardType, smartCards: Map<Int, SmartCard>, activeSelectionCaseId: Int? (only the card of the last successful selection remains active) |
MultichannelCardSelectionResult | cardType: CardType, smartCards: Map<Int, SmartCard> (all active, one per channel) |
CardSelectionResult (with getSmartCards(), getActiveSmartCard(), getActiveSelectionIndex()) and SelectionExecutionPolicy disappear.
Selectors
BasicCardSelectorandIsoCardSelectorbecome data classes built directly by the application (instead of “builder” interfaces created byReaderApiFactory.createBasicCardSelector()/createIsoCardSelector(), which are removed):BasicCardSelector:cardType: CardType? = null,powerOnDataRegex: String? = null;IsoCardSelector: the same, plusdfName: ByteArray? = null,fileOccurrence: FileOccurrence = FileOccurrence.FIRST,fileControlInformation: FileControlInformation = FileControlInformation.FCI.
CardSelector<T>becomes a sealed interface without members, whose only implementations are these two selectors.- The intermediate interface
CommonIsoCardSelector<T>is removed; its nested enumerations becomeFileOccurrenceandFileControlInformation(namespacereader.selection). filterByDfName(String)(AID in hexadecimal) is removed:dfNameis aByteArray.
Selector and extension pairing
A selection case is the pairing of a card selector with the selection extension of the same family. The preparation operations carry that pairing in their signature, so a mismatch can no longer be expressed:
| Family | Selector | Selection extension | Preparation operation |
|---|---|---|---|
| ISO/IEC 7816-4 | IsoCardSelector | IsoCardSelectionExtension | prepareIsoSelectionCase, on every manager |
| Non-ISO | BasicCardSelector | BasicCardSelectionExtension | prepareBasicSelectionCase, on the single-channel managers only |
CardSelectionExtension, the former common marker, is removed: no operation accepted it any more, and each card extension now declares its family.CalypsoCardSelectionExtensionandGenericCardSelectionExtensionare ISO extensions;StorageCardSelectionExtensionandLegacySamSelectionExtensionare basic ones.- Being restricted to ISO/IEC 7816-4 cards,
MultichannelCardSelectionManagerexposes only the ISO preparation operation: its restriction is no longer a sentence in the documentation but a property of its surface. - A single scenario MAY still mix the two families — an ISO case and a basic one, for a terminal accepting both a Calypso card and a storage card — since both operations feed the same scenario.
10.3 Card API — selection SPIs per family
The same pairing applies to the card-extension side:
CardSelectionExtensionSpikeeps onlygetCardSelectionRequest(); the parsing of the selection response moves toBasicCardSelectionExtensionSpi(parse(…) → SmartCardSpi) andIsoCardSelectionExtensionSpi(parse(…) → IsoSmartCardSpi), counterparts of the two public markers.IsoSmartCardSpiis inserted betweenSmartCardSpiandMultichannelSmartCardSpi, so that the multi-channel facet derives from the ISO one. A card extension that is not ISO can therefore no longer produce a smart card active on a logical channel.- The correspondence table of the Card API lists one row per family, and gains the
IsoSmartCard/IsoSmartCardSpirow that was missing.
10.4 Rationale
- No side effect: the selection mode is set when the manager is created.
- Unambiguous results: each result only exposes what makes sense in its mode; deducible properties and the “channel 0 card” / “first active index” contradiction disappear.
- Identifiers chosen by the application, consistent with
commandId(Theme 7). - Naming: Single and Multiple designate the number of successful selections kept in the result, not a number of cards; all the selections of a scenario target the same card.
11. Theme 10 — Implementation-language-independent specification
11.1 Motivation
The Terminal APIs were until now defined by Java interfaces. This model de facto tied the APIs to the JVM and hindered their implementation in other environments (native mobile applications, embedded systems, non-Java terminals). The new design proposal aims to broaden the choice of implementation languages: Kotlin Multiplatform (KMP), Rust, Swift, C#, etc., in addition to Java. The new specifications are therefore written in a language-independent notation, inspired by Kotlin, so that each binding translates the contract into the most idiomatic form of its platform. This notation entails systematic changes of form, described below; most of them do not affect behaviour, but all of them affect the way calling code is written.
11.2 Notation principles
| Principle | In production (Java) | In the specifications | Examples |
|---|---|---|---|
| Basic types | byte, short, int, long, boolean, byte[], Integer… | Byte, Short, Int, Long, Boolean, ByteArray, Int?… (Data types table of each spec) | — |
| Explicit nullability | null values documented in the Javadoc | T? type; otherwise the value is never null | getFileBySfi(sfi: Byte) → ElementaryFile? |
| Fluent chaining | recursive genericity T extends X<T> | Self return type; no more recursive genericity | TransactionManager.prepareReadRecords(...) → Self |
| Data classes | “builder” interfaces (setters) or read interfaces (getters), created by the factory | immutable data classes with properties (val) and default values, built directly by the application; the corresponding create… operations disappear from the factory | SearchCommandData, BasicCardSelector, CardDetectionSettings, ApduRequest |
| Enumerations | enumerations nested in an interface | top-level enumerations, named autonomously | CardReaderEvent.Type → CardReaderEventType |
| Data specific to an enumeration value | methods of the enumeration | properties of the enumeration | StorageCardProductType.blockSize |
| Closed types | open generic interface | sealed interface | CardSelector, SignatureComputationData, SignatureVerificationData |
| Interfaces without operations | empty interface | marker interface | ScheduledCardSelectionsResponse, BasicCardSelectionExtension, IsoCardSelectionExtension |
| Errors | …Exception classes (checked or unchecked) | errors named without suffix, carrying message: String and cause: Any? | CardCommunicationException → CardCommunication |
| Technical suffixes | …Spi, …Api on the data types of the Card API and the crypto APIs | removed for data; kept for contract interfaces | ApduRequestSpi → ApduRequest, SvCommandSecurityDataApi → SvCommandSecurityData |
| Unique operation names | overloads (same name, different parameters) | one unique name per operation within an interface and its hierarchy; By…, With…, For… suffixes | prepareSelectFile → prepareSelectFileByLid / prepareSelectFileByControl |
| Universal type | Object, Throwable | Any | onReaderError(context, readerName, error: Any) |
| Reflection | Class<E> | removed | getCryptoExtension(Class<E>) → getCryptoExtension() (see Theme 14) |
| Serialisation | extends Serializable | removed from the notation | ApduResponseApi, CardResponseApi |
11.3 Normative contracts
Each operation is now described by a normative table that specifies:
- its signature, its introduction version (Since) and its description;
- its pre-conditions, each prefixed by its nature, which determines the error raised if it is not met: Argument (invalid argument, including a value outside the bounds of the card or SAM protocol), Range (position outside the bounds of a collection or memory image exposed by the API), State (illegal state), Capability (unsupported operation);
- its errors, i.e. the situations a correct caller must handle;
- cross-references to related operations and types.
The specifications also define common rules (non-null results unless stated otherwise, empty collections rather than null, instances not shared between threads, default parameter values) as well as, for the Card API and the crypto APIs, conformance clauses that establish the correspondence between their types and those of the Reader API or the Calypso Card API (for example, any object implementing ProxyReaderApi must also implement CardReader).
11.4 Rationale
- Portability: the contract no longer imposes any Java-specific mechanism (reflection, recursive genericity, overloads); it can be transposed into any language, including those without overloading or class inheritance (Rust in particular), which paves the way for implementations in Kotlin Multiplatform, Rust, Swift or C#.
- Robustness: explicit nullability and immutable data eliminate invalid states (incomplete “builder” object, unexpected
nullvalue). - Precision: typed pre-conditions and errors listed per operation make the contract verifiable.
- Java binding: the way the Java binding will implement these principles (data classes,
Self, default values) is part of the alignment of the Keypop modules and of the migration guide (see §22).
12. Theme 11 — Data exposed without computation and access to raw data
12.1 Motivation
Several data types of the production versions mixed data and computations (decoding a counter from a record, selecting a parameter by number), exposed both a raw value and its decoded fields, or served both as input and output. The specifications apply three rules:
- no computational operation on a data type: such computations are performed by the live object that holds the data (
CalypsoCard,LegacySam); - no field deducible from other fields in a data class;
- no input/output object: inputs are parameters, outputs are returned values.
12.2 Calypso Card API
FileDatais removed, together with its operationsgetContent(),getContent(numRecord),getContent(numRecord, dataOffset, dataLength),getAllRecordsContent(),getContentAsCounterValue(numCounter)andgetAllCountersValue():- the records are exposed directly by the
ElementaryFile.records: SortedMap<Int, ByteArray>property (instead ofElementaryFile.getData()); - counter values are obtained through
CalypsoCard.getCounterValuesBySfi(sfi: Byte) → SortedMap<Int, Int>?andCalypsoCard.getCounterValuesByLid(lid: Short) → SortedMap<Int, Int>?.
- the records are exposed directly by the
DirectoryHeader:getKif(WriteAccessLevel)andgetKvc(WriteAccessLevel)become the propertieskifByAccessLevel: Map<WriteAccessLevel, Byte>andkvcByAccessLevel: Map<WriteAccessLevel, Byte>.SearchCommandDatabecomes an input data class (sfi,searchData,startAtRecord = 1,offset = 0,repeatedOffset = false,mask: ByteArray? = null,fetchFirstMatchingResult = false); the result is read throughCalypsoCard.getMatchingRecordNumbers(commandId)(see Theme 7);CalypsoCardApiFactory.createSearchCommandData()disappears.SvLoadLogRecordandSvDebitLogRecordbecome data classes without therawDataproperty, which is redundant with the decoded fields. The raw values remain accessible through three newCalypsoCardoperations:getSvLoadLogRecordRawData() → ByteArray?,getSvDebitLogLastRecordRawData() → ByteArray?andgetSvDebitLogAllRecordsRawData() → List<ByteArray>; each returned decoded object is the decoding of the raw value at the moment of the call.DirectoryHeader,ElementaryFileandFileHeaderbecome data classes.
12.3 Legacy SAM API
KeyParameterbecomes theKeyParametersdata class, renamed to the plural like thegetSystemKeyParameters/getWorkKeyParameters…getters that return it (kif,kvc,algorithm,parameterValues: SortedMap<Int, Byte>), withoutrawData;getParameterValue(parameterNumber)is replaced by theparameterValuesproperty. The raw values are accessible throughLegacySam.getSystemKeyParametersRawData(systemKeyType),getWorkKeyParametersRawDataByRecordNumber(recordNumber)andgetWorkKeyParametersRawDataByKifKvc(kif, kvc).SamParametersis removed:LegacySam.getSamParameters()directly returnsByteArray?.- Counters:
getCounter(counterNumber)andgetCounterCeiling(counterNumber)are removed (thegetCounters()andgetCounterCeilings()tables are sufficient);getCounterIncrementAccess(counterNumber)is replaced bygetCounterIncrementAccesses() → SortedMap<Int, CounterIncrementAccess>. - Command data:
LegacyCardCertificateComputationData,BasicSignatureComputationData,TraceableSignatureComputationData,BasicSignatureVerificationDataandTraceableSignatureVerificationDatabecome input data classes (properties and default values instead of setters;withSamTraceabilityMode(offset, mode)becomessamTraceabilityMode/traceabilityOffset,withoutBusyMode()becomesbusyMode = false); their results are read from theLegacySambycommandId(see §8.5).KeyPairContaineris removed. Thecreate…Data()andcreateKeyPairContainer()operations disappear fromLegacySamApiFactory. SecuritySettingbecomes theLegacySamSecuritySettingsdata class (samReader,controlSam), renamed to the plural like the security settings of the Calypso Card API, and prefixed to avoid the homonymy with theSecuritySettingsof the Calypso Card API, instead ofsetControlSamResource(samReader, controlSam);LegacySamApiFactory.createSecuritySetting()disappears.
12.4 Card API
ApduResponseonly keepsapdu(andapduExchangeDurationUs):getDataOut()andgetStatusWord()are removed, as they can be deduced fromapdu.ApduRequestSpi,CardRequestSpi,CardSelectionRequestSpi,ApduResponseApi,CardResponseApiandCardSelectionResponseApibecome the data classesApduRequest,CardRequest,CardSelectionRequest,ApduResponse,CardResponseandCardSelectionResponse. Default values are explicit:successfulStatusWords = setOf(0x9000),successfulSelectionStatusWords = setOf(0x9000),info = null,cardRequest = null.
12.5 Crypto Symmetric API
SvCommandSecurityDataApi(input/output object) is replaced:- the inputs become parameters:
computeSvCommandSecurityData(svGetRequest: ByteArray, svGetResponse: ByteArray, svCommandPartialRequest: ByteArray) → SvCommandSecurityData; - the output is the
SvCommandSecurityDatadata class (serialNumber,transactionNumber,terminalChallenge,terminalSvMac, non-nullable).
- the inputs become parameters:
createCardTransactionManager(..., exchangedApdus: MutableList<ByteArray>): the parameter is renamed — the list receives the exchanged APDUs, not transaction audit data — and is explicitly mutable (the crypto module appends its data to it).cipherPinForPresentationandcipherPinForModificationtake non-nullablekif: Byteandkvc: Byte(instead of boxedByte).
12.6 Crypto Asymmetric API
CaCertificateContentSpibecomes theCaCertificateContentdata class; theisAidCheckRequestedproperty is removed, as it can be deduced fromaid(nullwhen the AID check is not requested).CardPublicKeySpiis removed: the card public key is aByteArray(CardCertificateSpi.checkCertificateAndGetPublicKey(...) → ByteArray,AsymmetricCryptoCardTransactionManagerSpi.initTerminalPkiSession(cardPublicKey: ByteArray)).- A conformance clause establishes the correspondence between the SPIs of this API and the marker interfaces of the Calypso Card API (
PcaCertificate,CaCertificate,CardCertificate, the parsers and the factory).
12.7 Rationale
- An API describes data and behaviours, not decoding algorithms: computations on data remain the responsibility of the object that holds them.
- No double truth: a deducible field can diverge from its source; removing it eliminates the risk.
- Raw access preserved where it has a real use (transmission to the back office, re-injection of key parameters into transfer commands).
13. Theme 12 — Stored Value (SV) operations
13.1 Motivation
The Calypso card specification defines three SV commands — Reload, Debit and Undebit — preceded by an SV Get command, one parameter of which indicates the targeted operation: Reload or Debit/Undebit. The production model additionally introduced a DO/UNDO notion (SvAction) that does not exist for reloading and hid the undebit behind prepareSvDebit.
13.2 Calypso Card API
SvActionis removed.prepareSvGet(svOperation: SvOperation) → Self— only takes the operation.SvOperation.DEBITis renamedDEBIT_UNDEBIT, in accordance with the card specification;RELOADis unchanged.- New operation
prepareSvUndebit(amount: Int, date: ByteArray, time: ByteArray) → Self— cancels, totally or partially, a previous debit; amount in0..32768. prepareSvDebit(amount: Int, date: ByteArray, time: ByteArray) → Self— now only performs the debit; amount in0..32767.prepareSvReload(amount: Int, date: ByteArray, time: ByteArray, free: ByteArray) → Self— amount in-8388608..8388607(a negative reload is expressed directly by a negative amount).- The overloads without data
prepareSvDebit(int)andprepareSvReload(int)are removed: all parameters are mandatory and non-nullable; thedate,timeandfreefields (2 bytes each) are recorded in the SV log. - Each command requires an immediately preceding SV Get prepared with the corresponding operation (
DEBIT_UNDEBITfor debit and undebit,RELOADfor reload): no other command may come between them. On an automatic session split, the SV Get is re-issued in the new session, right before the SV command.
13.3 Rationale
The model now follows the card specification exactly: three commands, two SV Get contexts. The amount range and the log data are explicit in each operation.
14. Theme 13 — Tolerance of a missing file or record in a secure session
14.1 Motivation
All Calypso cards now tolerate the 6A82h (File Not Found) and 6A83h (Record Not Found) status words in a secure session for read commands (Select File, Get Data, Read Binary, Read Records, Read Record Multiple, Search Record Multiple). On a heterogeneous card fleet, the presence of a file or of a record is not always known in advance, and an unsuccessful read should not cancel the session.
The tolerance is explicitly enabled by the integrator: the default behaviour, stricter, remains the failure of the transaction inside a session.
14.2 Calypso Card API
- Two new security settings:
authorizeFileNotFoundError() → SelfandauthorizeRecordNotFoundError() → Self, carried by the parent interfaceSecuritySettingsand therefore available inSymmetricCryptoSecuritySettingsas well as inAsymmetricCryptoSecuritySettings. They allow the card to answer6A82hor6A83hinside a session without failing the transaction: the affected command is simply not applied to theCalypsoCardand the session continues. They are disabled by default. - Reads (
prepareReadBinary,prepareReadCounter,prepareReadRecords) and file selection (prepareSelectFileByLid,prepareSelectFileByControl): outside a session, a missing file has never caused processing to fail, and this best-effort mode is unchanged; inside a session, processing fails unless the corresponding setting has been enabled. An invalid offset keeps the two modes best-effort (outside a session) and strict (inside a session). - The
SelectFileExceptionerror is removed. - The in-session usage restrictions of
prepareReadRecord,prepareReadRecordsPartiallyandprepareSearchRecordsare unchanged: these commands must still not be used within a secure session, in both contact and contactless modes.prepareGetDatais relaxed for the single tagFCI_FOR_CURRENT_DF, now allowed inside a session so that the integrity of the FCI obtained in response to Select Application can be checked: the followingprocessCommands()raisesInconsistentDataif the returned FCI differs from that response. The length of the data read being bounded, the session is not exposed; every other tag remains forbidden.
15. Theme 14 — Crypto extensions and command interleaving
15.1 Motivation
During a card transaction, the application must be able to access the specific operations of the crypto module (for example signature computation by a SAM) in order to interleave card commands and crypto commands within the same transaction. The crypto extension is the instance created, for the current transaction, by the crypto module factory attached to the security setting.
15.2 Calypso Card API
<E extends CardTransactionCryptoExtension> E getCryptoExtension(Class<E> cryptoExtensionClass)becomesgetCryptoExtension() → CardTransactionCryptoExtension:- the operation returns the instance created for this transaction; successive calls return the same instance;
- commands prepared through the extension join the same queue as the card commands, in call order, and are processed by the same
processCommands(); - the caller converts the instance to the concrete type defined by the crypto module in use (for example
CardTransactionLegacySamExtension).
15.3 Legacy SAM API
CardTransactionLegacySamExtension.prepareComputeSignature(commandId, data)andprepareVerifySignature(commandId, data)follow thecommandIdmodel (see §8.5).
15.4 Rationale
The Class<E> parameter only existed to work around the JVM’s type erasure; it has no equivalent in other languages (Rust in particular). The chosen signature is identical in all bindings, and the identity clause guarantees that the obtained extension is indeed the one sharing the transaction’s command queue.
16. Theme 15 — Validity of the Calypso HCE token
16.1 Motivation
The application serial number of a Calypso HCE application is made of two fields: the two most significant
bytes, the SN Header, carry the end of validity of the token, coded as the number of half-days elapsed
since 1 January 2010 at 0:00 local time; the six remaining bytes identify the application. What that validity
materialises depends on the cryptographic nature of the transaction: in symmetric-key mode it is the end of
validity of the debit key; in PKI mode it is the expiry date of the key carried by the card certificate.
The API names the token, which has a single validity window whatever the mode. Nothing in the card dialogue reveals
an outdated header: in symmetric-key mode the header takes part in the diversification of the keys, so a mobile
whose validity window has passed still authenticates normally, and in PKI mode the expiry is attested by the card
certificate and is not signalled by the card either. The verification therefore belongs to the terminal, and
the production versions offered nothing for it — getApplicationSerialNumber() returns the serial number with its
two most significant bytes forced to 0, so the header was not even readable.
16.2 Calypso Card API
- New SPI
HceTimeProvider(namespacecalypso.card.spi, a new namespace for the services the application provides to the card extension):getCurrentLocalEpochSeconds() → Long— the current time expressed in the same reference as the SN Header, that is local time, as a number of seconds since 1 January 1970 at 0:00 in that reference. The application provides the clock it trusts; the Calypso encoding and the comparison stay in the specification.
- New factory operation
CalypsoCardApiFactory.setHceTimeProvider(provider) → Self— the service is consulted when the selection response is parsed, by the side that holds the card extension, and is never carried by an exported selection scenario. - New accessors on
CalypsoCard:getHceTokenExpiryLocalEpochSeconds() → Long?— the decoded header, converted into seconds since 1 January 1970 at 0:00 local time; part of the card image and therefore carried by an exported processed scenario;nullwhen the application is not HCE or the header is not significant;isHceTokenValid() → Boolean?— the verdict computed by the card extension,nullwhen no evaluation took place.
- New setting
SecuritySettings.authorizeExpiredHceToken() → Self, on the contract shared by the symmetric and asymmetric settings. - New State pre-condition on both
prepareOpenSecureSessionoperations: the card is not a Calypso HCE application whose token has expired or could not be evaluated, unless the authorisation above has been given. getApplicationSerialNumber()now documents the masking of the two most significant bytes for an HCE application.
16.3 Rationale
The card is never hidden: an application whose token has expired is selected like any other and the verdict is exposed, so the ticketing layer can refuse the service, invite the holder to renew the token, or simply log the event. Making the selection fail would have been indistinguishable from an unknown card, leaving the holder without an explanation and masking a provisioning outage from the operator.
The application is asked for a clock, not for a verdict: the half-day encoding and the 2010 epoch are Calypso conventions, which the specification keeps for itself, while the time reference — local, and necessarily the one in which the tokens were provisioned — is the only thing the application can state. The resolution being half a day, a difference of time zone between the terminal and the issuer of the token shifts the boundary of the validity window by the corresponding offset.
The protection is therefore placed where it matters, at the opening of a secure session, and it covers every secure session whatever its mode and its write access level. It is expressed as a pre-condition rather than as an error raised during the exchange, because the verdict is known as soon as the card is selected: an application that prepares such an opening has ignored an answer it already had.
17. Theme 16 — Card power and RF field
17.1 Motivation
Between two transactions, a terminal often needs the card to be de-energised: to bring a security module back to
a known state, to comply with a power budget, or to make sure that the next card starts from a clean state. The
production versions offered nothing for it at this level, and the only way to end the dialogue with a card was the
observation-specific finalizeCardProcessing(), which a non-observable reader did not expose at all.
17.2 Reader API
endCardProcessing()moves fromObservableCardReadertoCardReader: every reader, observed or not, now has a way to close the dialogue with the card. No existing caller is broken.- The operation gains its electrical effects: the power is removed from the card, and the field is switched off on a contactless reader, except while the reader goes on using it. What exactly happens depends on the situation:
| Situation | Effect |
|---|---|
| The reader is not observable, or its card detection is not active | Card powered off, field switched off |
Card detection is active in REPEATING mode | Waiting-for-card-removal phase, then detection of the next card; the field stays on throughout, first to observe the departure, then for the search for the next card |
Card detection is active in SINGLE_SHOT mode | Detection stops: card powered off, field switched off |
- The operation reports nothing: it raises no error, and failures of the underlying exchanges — including a
communication failure with the card or with the reader — are not reported. It is meant to be called in a
finallyblock, where raising would mask the business failure being handled; the condition surfaces at the next operation. startCardDetection()applies the energy the polling requires: the field is switched on on a contactless reader, and a card already present in the slot of a contact reader is powered, then processed as a newly detected one.stopCardDetection()removes the power and switches the field off, no polling remaining to be performed. While a processing cycle is in progress the effect is held back, untilendCardProcessing()ends the cycle.isCardPresent()may, on the contrary, require the card to be powered; an implementation may also defer the power-on until the first exchange. It never de-energises a card that is already powered. On a contactless reader it switches the field on, and the field stays on, when a card answers, until the end of the cycle. On a contact reader without a presence switch, the reader either answerstrueby default or attempts to energise the card and answers according to the outcome — an observable reader uses the second approach, so that its detection does not report a card that is not there.SINGLE_SHOTis clarified: detection stops at the end of the cycle without waiting for the card to leave, which the previous wording suggested.- New section Card power and RF field in the architectural overview, which states the principle of these effects and summarises the state targeted after each call:
| Call | Contact, card | Contact, no card | Contactless, card | Contactless, no card |
|---|---|---|---|---|
isCardPresent(), detection inactive | Reader-dependent | Off | On | Off |
| Synchronous selection, detection inactive | On | Off | On | Off |
startCardDetection() | On | Off | On | On |
stopCardDetection(), no processing cycle in progress | Off | Off | Off | Off |
stopCardDetection(), processing cycle in progress | Held | Off | Held | Off |
endCardProcessing(), detection inactive | Off | Off | Off | Off |
endCardProcessing(), SINGLE_SHOT mode | Off | Off | Off | Off |
endCardProcessing(), REPEATING mode | On | Off | On | On |
On means that the energy is applied — the card is powered on a contact reader, the field is on on a contactless
reader; Off means that it is not; Held means that the preceding state is left unchanged for the time being.
stopCardDetection() and endCardProcessing() end on Off whichever is called first, and on a contactless
reader endCardProcessing() switches the field off even when the cycle amounted to nothing more than a call to
isCardPresent().
17.3 Rationale
The specification describes effects, never capabilities: hardware differs too widely for a terminal API to declare what a reader can do. These effects are therefore provided on a best-effort basis — a reader that cannot carry them out performs what it can, raises no error, and reports nothing. An application must not rely on them for a security purpose; it relies on them to leave the reader in a sane state.
Finer control — switching the field on and off on demand, resetting a card, choosing a power policy — stays outside the scope of the Terminal APIs and belongs to the interfaces each reader implementation exposes on its own.
18. Theme 17 — Card revocation
18.1 Motivation
An issuer may withdraw a card from service — one reported lost or stolen, one that is the subject of a dispute, one
whose holder’s entitlement has ended. Nothing in the card records that decision: it lives in a list the issuer
maintains, outside the card. The production versions offered nothing at this level, so the check was entirely the
application’s business, with no contract stating when it had to happen nor what had to follow. The Legacy SAM API
already had the equivalent for a SAM — LegacySamRevocationServiceSpi and the SamRevoked error; the card side
had nothing.
18.2 Calypso Card API
The design is the one of Theme 15, applied to a second verdict:
- New SPI
CardRevocationStatusProvider(calypso.card.spi):isCardRevoked(applicationSerialNumber: ByteArray) → Boolean— the operation always answers: no third value reports an unavailable list or an incomplete cache, such a fallback belonging to the provider, the only component holding the operational context. The lookup key is the 8-byte application serial number; no partial match is defined, a prefix designating no single card. For an HCE application the two most significant bytes are forced to0, so the key survives the renewal of the token.
- New factory operation
CalypsoCardApiFactory.setCardRevocationStatusProvider(provider) → Self. - New accessor
CalypsoCard.isRevoked() → Boolean?— the verdict, part of the card image and therefore carried by an exported processed scenario;nullin a single case, when no provider was registered. Not to be confused withisDfInvalidated(), which reports an invalidation carried by the card itself. - New setting
SecuritySettings.authorizeRevokedCard() → Self, on the contract shared by the symmetric and asymmetric settings. - Second State pre-condition on both
prepareOpenSecureSessionoperations: the card is not revoked and its revocation status could be verified, unless the authorisation above has been given. - New section Application-supplied services in the architectural overview, stating once the rules shared by this provider and the HCE time provider: consultation when the selection response is parsed, by the side holding the card extension; locality, the verdict alone being exported; and the ban on blocking remote calls, these services running inside the contactless window.
18.3 Rationale
The check is fail-closed, including when no provider is registered. Nothing in a card signals that a revocation
check is due — unlike the SN Header, which announces an HCE validity window by its mere presence. The trigger is
therefore the opposite one: absent a provider, the status is unverified, and no secure session may be opened until
authorizeRevokedCard() is called. Every integration must consequently state something: register a provider,
or authorise cards whose revocation status is unknown. This is the doctrine of Theme 2 applied here — a security
control must not be silently absent — and the name of the flag states the accepted risk instead of hiding it behind
a permissive default.
Two separate SPIs rather than one. The HCE time provider and the revocation status provider share a category, not a contract. A fleet without HCE applications has no clock to provide; a clock is a platform concern and a revocation list a back-office one, implemented by different components on different release cycles; and adding an operation to a published SPI breaks every one of its implementers. The Legacy SAM API makes the same choice, with distinct SPIs for revocation and for unlock data. What the two do share is factored into one architectural section rather than into one interface.
The provider’s answer is not nullable. A third value reporting an unknown status would make a transient
condition — a back-office outage — violate a State pre-condition, whereas every pre-condition of the family
describes a stable state the application controls. It would also leave an integrator without a way to degrade
gracefully, authorizeRevokedCard() being a configuration-time decision rather than a per-transaction one. The
fallback therefore stays with the provider, which alone knows the age of its cache and the policy of the operator,
and null keeps a single meaning on isRevoked(): no provider was registered. Should distinguishing unknown
prove necessary for the ticketing decision, it would call for a typed status, not for a nullable Boolean.
The card is never hidden, as for an expired HCE token: a revoked card is selected like any other and the verdict is exposed, so the ticketing layer can refuse the service, raise an alert or log the event. Making the selection fail would have been indistinguishable from an unknown card.
19. Theme 18 — Transaction counter
19.1 Motivation
A Calypso card decrements a transaction counter each time it performs an operation involving one of its secret keys. The counter only ever decreases, and once it reaches zero the card refuses the operations that consume it — the medium then has to be replaced. A network therefore has an interest in watching that counter, so as to anticipate the renewal of its media rather than discover their exhaustion in front of a gate.
CalypsoCard.getTransactionCounter() existed since version 1.2, but two limits made it unusable for that purpose:
it carried a State pre-condition requiring an open secure session, and its value was defined as coming from
the last successful Open Secure Session during that session. The value could therefore not be read before or
after the transaction — precisely when an application decides whether to renew a medium.
19.2 Calypso Card API
getTransactionCounter() → Int?(was→ Int): the State pre-condition disappears, and the value is now the one the card reported at the last Open Secure Session, whichever performed it — a session opening operation, or the pre-opening prepared during the card selection.- The value is the up-to-date one, returned by the card after the opening has consumed it: it is what the card holds once the session is open, not what it held before. A pre-opened session is not charged twice — the pre-opening consumes one unit and reports the result, and the session opening that consumes it afterwards consumes nothing more and reports that same value.
- No dedicated command: the value comes from an opening the application performs anyway. Reading the counter without opening a session would require a Get Challenge, which is deliberately not exposed.
nulluntil an opening has taken place: at least one secure session opening, or one pre-opening throughCalypsoCardSelectionExtension.preparePreOpenSecureSession(), must have been performed for a value to be available.- As early as the selection: a pre-opening makes the value available as soon as the selection response is parsed, before any transaction manager exists. The value belongs to the card image, and is therefore carried by an exported processed selection scenario, so that a thin client reads a counter obtained by the side holding the card extension.
- New section Transaction counter in the architectural overview.
19.3 Rationale
The exposed value is an upper bound, and the specification says so. Operations that consume the counter without returning it — a key or PIN decryption, a Stored Value operation performed outside a secure session — decrement it without this value following. The bias is therefore optimistic: an application watching the counter for renewal purposes may believe more transactions remain than the card will grant. Stating the direction of the error matters more than stating that an error exists, since the whole point of the value is to trigger a decision.
The properties of the counter are not described here. Its width, its initial value, the operations that consume it and whether it is shared by every application of the card depend on the card product and on its revision; older products may even hold one counter per application. These belong to the Calypso card specifications, and this API exposes the value, not those properties.
20. Normative clarifications
The specifications also bring clarifications that do not change signatures but specify the contract:
- Card API — APDU construction rules: commands must strictly comply with ISO/IEC 7816-3; a case 4 command must include the
Lefield, for which the value00his recommended (it was previously presented as mandatory). - Card API — limitations: the transmission of the Select Application by DF name command (reserved to the
CardSelectionRequest) and of the Get Response command (status words61XYhand6CXYhare handled automatically by the reader implementation) cannot be requested. - Card API — timing countermeasures: the APDU exchange execution-time control mechanism is explicitly presented as a countermeasure against both relay and emulation (see Theme 2).
- Reader API —
SmartCardlifecycle: now normative (see §2.3.2). - All APIs — pre-condition natures: an explicit criterion distinguishes Range (position in a collection or memory image exposed by the API) from Argument (any other invalid value, including values bounded by the card or SAM protocol).
- Storage Card API — scope: the Scope section explicitly lists the supported products (MIFARE Ultralight, MIFARE Classic 1K, MIFARE Classic 4K, ST25 SRT512), identified by the values of
StorageCardProductType.
21. Elements under study
The following elements appear in grey in the Legacy SAM API diagram; they are not part of the normative scope submitted for validation:
LegacySamApiFactory.createSecureReadTransactionManager(samReader, sam, securitySettings)and theSecureReadTransactionManagerinterface;FreeTransactionManager.preparePlainLoadWorkKey(...)andpreparePlainExportWorkKey(...);LegacySamSelectionExtension.prepareReadCaadRecord(...)/prepareReadCaadRecords(...)and their equivalents onReadTransactionManager;SecureWriteTransactionManager.prepareWriteCaadRecord(...).
22. Migration procedure
Migrating application code from the production versions to the new versions will be covered by a dedicated technical migration guide, published separately after validation by the TC Terminal and after alignment of the associated Keypop Java implementations.
This guide will aim to simplify the transition as much as possible: 1:1 mapping of removed / renamed / redesigned elements (of which Annex A is the basis), rewriting patterns (before / after) for the most common use cases, progressive adoption rules and known pitfalls. It will also describe the Java implementation of the notation principles of Theme 10 (data classes, Self, default values, nullability).
23. Next steps and validation by the TC Terminal
23.1 Scope submitted for validation
This document submits to the validation of the CNA TC Terminal:
- The principle of the eighteen evolution themes (§2 to §19) and the overall consistency of the work (versions 3.0.0 for Reader / Card / Calypso Card, 1.0.0 for Definitions, 2.0.0 for Legacy SAM / Generic Card / Storage Card, 0.2.0 for Crypto Symmetric, 0.3.0 for Crypto Asymmetric).
- The design choices documented in the “Rationale” sections, in particular:
- the explicit multi-channel model relying on the
SmartCard(Spi)as the named target and the three-level hierarchy of transaction managers (§2); - duration bounding at the APDU, generic command and storage card read levels, the Calypso countermeasure being delegated in full to the implementation (§3);
- the merge of the Observer pattern into a single
CardReaderEventHandlerSPI (§4); - the
SecureSessionStateenumeration (§5); - the extraction of
RfTechnologyandCardTypeinto the Terminal Reader Definitions API and theCardDetectionSettingsdetection settings (§7); - the generalised
commandIdmodel (§8); - standardised reader discovery through
CardReaderProvider(§9); - the hierarchy of selection managers per mode and the three result types (§10);
- the language-independent notation and its principles, which aim to broaden the choice of implementation languages (KMP, Rust, Swift, etc.) (§11);
- data without computation and access to raw data (§12);
- the SV model aligned with the card specification (§13);
- the tolerance of a missing file in a session (§14);
- access to the crypto extension with an identity clause (§15);
- the validity of the Calypso HCE token, verified by the terminal from a clock the application provides (§16);
- card power and RF field described as effects provided on a best-effort basis rather than as capabilities (§17);
- the revocation status of a card, obtained from a service the application provides, and checked before any secure session (§18);
- the transaction counter exposed outside any secure session, fed by the openings the application already performs, for anticipating the renewal of a medium (§19).
- The detailed content of the nine specifications and their diagrams (see Reference documents).
- The introduction of the new Reader Definitions foundation API.
- The principle of a dedicated migration procedure (see §22).
23.2 Points of attention for the review
- the stability of the initial content of the
RfTechnologyandCardTypeenumerations (§7.2), in particular the representation of ISO 14443-4 by a singleISO_14443_4value; - the complete removal of
ConfigurableCardReaderwithout a deprecation phase (§7.3); - the delegation of the Calypso relay countermeasure to the implementation (§3.3): no configuration operation is exposed, the bound being resolved from a calibration performed against the deployed implementation; the specification only designates the bounded exchanges and the behaviour on overrun;
- the enforcement of the Calypso duration bounds (§3.1, §3.3): both what is measured (the relevant command exchange alone) and the consequence of an overrun (automatic cancellation of an open session, error propagation outside a session) are now specified;
- the naming of the HCE token concept (§16), chosen to cover both cryptographic natures — the debit key in symmetric-key mode, the key carried by the card certificate in PKI mode — while an update of the official Calypso specifications is in progress on this subject;
- the fail-closed default of the card revocation check (§18.3): absent a registered
CardRevocationStatusProvider, the status counts as unverified and no secure session may be opened untilauthorizeRevokedCard()is called — every integration must therefore state one or the other, which the migration guide will have to cover; - the three-level gradation of transaction managers (§2.2);
- the replacement of overloads by unique operation names (§11.2), which changes many operation names for Java integrators;
- the replacement of “builder” interfaces by data classes (§11.2, §12), whose Java implementation remains to be defined;
- the change from
SvOperation.DEBITtoDEBIT_UNDEBITand the removal of the SV overloads without data (§13).
23.3 Next steps
The versions were validated by the TC Terminal and the nine specifications are available as a preview on the documentation site. Their formal release is pending, and the following steps remain:
- Finalisation of the specifications: moving the repositories from their
…-SNAPSHOTversions to their final versions; removal or specification of the elements under study (§21); then tagging and publishing the release. - Writing and publication of the technical migration guide (see §22).
- Communication of the availability of the new versions to integrators and to the CNA working groups concerned.
Annex A — Detailed mapping per API
This annex lists, for each API, what becomes of each element of the Java versions in production. Unchanged elements (apart from the move to the Theme 10 notation: basic types, Self, explicit nullability) are not listed. The “after” signatures are expressed in the specification notation.
A.1 Terminal Reader API (Java 2.1.0 → 3.0.0)
| Element in production | What it becomes |
|---|---|
ReaderApiFactory.createCardSelectionManager() | Removed → createSingleCardSelectionManager(), createSequentialCardSelectionManager(), createMultichannelCardSelectionManager() |
ReaderApiFactory.createBasicCardSelector(), createIsoCardSelector() | Removed (selectors = data classes) |
| — | Added: ReaderApiFactory.getCardReaderProvider() → CardReaderProvider; CardReaderProvider interface |
ConfigurableCardReader (activateProtocol, deactivateProtocol, getCurrentProtocol) | Removed |
ObservableCardReader.setReaderObservationExceptionHandler, addObserver, removeObserver, clearObservers, countObservers | Removed |
ObservableCardReader.startCardDetection(DetectionMode) | → startCardDetection(settings: CardDetectionSettings, eventHandler: CardReaderEventHandler) |
ObservableCardReader.finalizeCardProcessing() | → CardReader.endCardProcessing(), moved up to CardReader and carrying the power-off of the card |
| — | Added: best-effort power and field effects on endCardProcessing() and stopCardDetection(); isCardPresent() may power the card |
| — | Added: ObservableCardReader.clearScheduledCardSelectionScenario() |
ObservableCardReader.DetectionMode (REPEATING, SINGLESHOT) | → DetectionMode (REPEATING, SINGLE_SHOT) |
ObservableCardReader.NotificationMode | → CardPresenceNotificationPolicy (namespace reader.selection) |
CardReaderEvent (interface) | → CardReaderEvent data class (readerName, type, scheduledCardSelectionsResponse?) |
CardReaderEvent.Type (…, UNAVAILABLE) | → CardReaderEventType (…, READER_UNREGISTERED) |
ChannelControl | Removed |
CardCommunicationException, ReaderCommunicationException, InvalidCardResponseException | → CardCommunication, ReaderCommunication, InvalidCardResponse |
ReaderProtocolNotSupportedException | Removed |
reader.selection.InvalidCardResponseException | Removed (duplicate) |
CardSelectionManager.setMultipleSelectionMode(), prepareReleaseChannel() | Removed |
CardSelectionManager.prepareSelection(CardSelector<?>, CardSelectionExtension) → int | → prepareIsoSelectionCase(selectionCaseId: Int, cardSelector: IsoCardSelector, cardSelectionExtension: IsoCardSelectionExtension) → Self on every manager, and prepareBasicSelectionCase(selectionCaseId: Int, cardSelector: BasicCardSelector, cardSelectionExtension: BasicCardSelectionExtension) → Self on the single-channel managers |
CardSelectionExtension (marker) | Removed → split into BasicCardSelectionExtension and IsoCardSelectionExtension, each paired with the selector of its family |
CardSelectionManager.importCardSelectionScenario(String) → int | → importCardSelectionScenario(cardSelectionScenario: String) → Self (replaces the scenario) |
CardSelectionManager.processCardSelectionScenario(CardReader) | → processCardSelectionScenario(reader) on SingleCardSelectionManager / SequentialCardSelectionManager; processCardSelectionScenario(reader, channelSelectionPolicy) on MultichannelCardSelectionManager |
CardSelectionManager.scheduleCardSelectionScenario(ObservableCardReader, NotificationMode) | → scheduleCardSelectionScenario(observableCardReader, cardPresenceNotificationPolicy) on the single-channel managers |
CardSelectionManager.parseScheduledCardSelectionsResponse(...) | → on the single-channel managers, returns the typed result |
CardSelectionManager.importProcessedCardSelectionScenario(String) | → on each manager, returns the typed result |
CardSelectionResult (getSmartCards, getActiveSmartCard, getActiveSelectionIndex) | Removed → SingleCardSelectionResult, SequentialCardSelectionResult, MultichannelCardSelectionResult |
| — | Added: ChannelSelectionPolicy |
CardSelector<T> (filterByCardProtocol, filterByPowerOnData) | → sealed interface CardSelector; filterByCardProtocol removed; filterByPowerOnData → powerOnDataRegex property; cardType property added |
BasicCardSelector (interface) | → data class (cardType?, powerOnDataRegex?) |
CommonIsoCardSelector<T> (filterByDfName(byte[]), filterByDfName(String), setFileOccurrence, setFileControlInformation) | Removed → dfName: ByteArray?, fileOccurrence, fileControlInformation properties of IsoCardSelector; filterByDfName(String) removed |
CommonIsoCardSelector.FileOccurrence, .FileControlInformation | → FileOccurrence, FileControlInformation |
IsoCardSelector (interface) | → data class |
SmartCard.getPowerOnData() | → getPowerOnData() → String?; isActive() → Boolean added |
IsoSmartCard.getSelectApplicationResponse() | → getSelectApplicationResponse() → ByteArray?; isBasicChannel() → Boolean added |
CardReaderObserverSpi.onReaderEvent(CardReaderEvent) | → CardReaderEventHandler.onReaderEvent(cardReaderEvent: CardReaderEvent) |
CardReaderObservationExceptionHandlerSpi.onReaderObservationError(String contextInfo, String readerName, Throwable e) | → CardReaderEventHandler.onReaderError(context: String, readerName: String, error: Any) |
CardTransactionManager<T>.processCommands(ChannelControl) → T | → CardTransactionManager.processCommands() → Unit (non-generic) |
| — | Added: IsoCardTransactionManager, MultichannelCardTransactionManager |
| — | Added: CardDetectionSettings data class |
A.2 Terminal Card API (Java 2.0.1 → 3.0.0)
| Element in production | What it becomes |
|---|---|
ApduRequestSpi (getApdu, getSuccessfulStatusWords, getInfo) | → ApduRequest data class (apdu, successfulStatusWords = setOf(0x9000), info: String? = null) + apduExchangeMaxDurationUsration: Long? = null |
ApduResponseApi (getApdu, getDataOut, getStatusWord, Serializable) | → ApduResponse data class (apdu) + apduExchangeDurationUs: Long?; getDataOut, getStatusWord removed |
CardRequestSpi (getApduRequests, stopOnUnsuccessfulStatusWord) | → CardRequest data class |
CardResponseApi (getApduResponses, isLogicalChannelOpen) | → CardResponse data class (apduResponses); isLogicalChannelOpen removed |
CardSelectionRequestSpi (getSuccessfulSelectionStatusWords, getCardRequest) | → CardSelectionRequest data class (successfulSelectionStatusWords = setOf(0x9000), cardRequest: CardRequest? = null) |
CardSelectionResponseApi (getPowerOnData, getSelectApplicationResponse, hasMatched, getCardResponse) | → CardSelectionResponse data class (same information, explicit nullability) + channel: Int |
CardSelectionExtensionSpi.getCardSelectionRequest(), parse(CardSelectionResponseApi) | → CardSelectionRequest / CardSelectionResponse types; CardSelectionExtensionSpi now keeps only getCardSelectionRequest(), parse moving to the two family SPIs |
SmartCardSpi | deactivate() → Unit added |
| — | Added: BasicCardSelectionExtensionSpi (parse(…) → SmartCardSpi) and IsoCardSelectionExtensionSpi (parse(…) → IsoSmartCardSpi), counterparts of the two public markers |
| — | Added: IsoSmartCardSpi (marker) and MultichannelSmartCardSpi (getChannel() → Int), the latter now extending the former |
ProxyReaderApi.transmitCardRequest(CardRequestSpi, ChannelControl), releaseChannel() | Removed → transmitCardRequest(cardRequest, smartCard), transmitCardRequestAndCloseChannel(cardRequest, multichannelSmartCard), closeChannel(multichannelSmartCard) |
ChannelControl | Removed |
AbstractApduException (getCardResponse, isCardResponseComplete) | Removed; cardResponse: CardResponse? and isCardResponseComplete: Boolean properties carried by the APDU errors |
CardBrokenCommunicationException, ReaderBrokenCommunicationException, UnexpectedStatusWordException, ParseException | → CardBrokenCommunication (also raised if the card is no longer active), ReaderBrokenCommunication, UnexpectedStatusWord, Parse |
| — | Added: ApduExchangeDurationExceeded error |
A.3 Terminal Calypso Card API (Java 2.3.0 → 3.0.0)
| Element in production | What it becomes |
|---|---|
CalypsoCardApiFactory.createSearchCommandData() | Removed |
CalypsoCard.getProductType() → CalypsoCard.ProductType | → getProductType() → CalypsoCardProductType |
CalypsoCard.getDirectoryHeader(), getFileBySfi, getFileByLid, getSvLoadLogRecord, getSvDebitLogLastRecord | → explicit nullable returns |
| — | Added: CalypsoCard.getCounterValuesBySfi, getCounterValuesByLid, getMatchingRecordNumbers(commandId), getSvLoadLogRecordRawData, getSvDebitLogLastRecordRawData, getSvDebitLogAllRecordsRawData |
CalypsoCard.ProductType | → CalypsoCardProductType |
TransactionManager.prepareDecreaseCounters(sfi, counterNumberToDecValueMap), prepareIncreaseCounters(sfi, counterNumberToIncValueMap) | → parameters renamed decrementValues, incrementValues |
SymmetricCryptoSecuritySetting, AsymmetricCryptoSecuritySetting | → SymmetricCryptoSecuritySettings, AsymmetricCryptoSecuritySettings |
CalypsoCardApiFactory.createSymmetricCryptoSecuritySetting(...), createAsymmetricCryptoSecuritySetting(...) | → createSymmetricCryptoSecuritySettings(...), createAsymmetricCryptoSecuritySettings(...); securitySetting parameter → securitySettings in createSecure…TransactionManager |
CalypsoCardSelectionExtension.prepareSelectFile(short) / prepareSelectFile(SelectFileControl selectControl) | → prepareSelectFileByLid(lid) / prepareSelectFileByControl(selectFileControl) |
DirectoryHeader (interface; getKif(level), getKvc(level)) | → data class; kifByAccessLevel, kvcByAccessLevel: Map<WriteAccessLevel, Byte> |
ElementaryFile (interface; getData()) | → data class (sfi, header?, records: SortedMap<Int, ByteArray>) |
ElementaryFile.Type | → ElementaryFileType |
FileData (all operations) | Removed (see §12.2) |
FileHeader (interface) | → data class (efType: ElementaryFileType) |
SvDebitLogRecord, SvLoadLogRecord (interfaces, getRawData) | → data classes without rawData |
SearchCommandData.setSfi, startAtRecord, setOffset, enableRepeatedOffset, setSearchData, setMask, fetchFirstMatchingResult | → properties of the SearchCommandData data class: sfi, startAtRecord = 1, offset = 0, repeatedOffset = false, searchData, mask: ByteArray? = null, fetchFirstMatchingResult = false |
SearchCommandData.getMatchingRecordNumbers() | → CalypsoCard.getMatchingRecordNumbers(commandId: Int) → List<Int>? |
TransactionManager<T> and generic sub-interfaces | → non-generic, Self returns; TransactionManager extends IsoCardTransactionManager |
TransactionManager.prepareSelectFile(short) / (SelectFileControl) | → prepareSelectFileByLid / prepareSelectFileByControl |
TransactionManager.prepareSearchRecords(SearchCommandData) | → prepareSearchRecords(commandId: Int, data: SearchCommandData) |
TransactionManager.getTransactionAuditData() | → getExchangedApdus() |
TransactionManager.processCommands(ChannelControl) | Removed (inherited CardTransactionManager.processCommands()) |
| — | Added: TransactionManager.getSecureSessionState() → SecureSessionState; SecureSessionState enumeration |
SecureTransactionManager.getCryptoExtension(Class<E>) → E | → getCryptoExtension() → CardTransactionCryptoExtension |
SecureSymmetricCryptoTransactionManager.prepareSvGet(SvOperation, SvAction) | → prepareSvGet(svOperation: SvOperation) |
prepareSvReload(int), prepareSvDebit(int) | Removed |
| — | Added: prepareSvUndebit(amount, date, time) |
SvAction | Removed |
SvOperation.DEBIT | → SvOperation.DEBIT_UNDEBIT |
| — | Added: SecuritySettings interface, parent of SymmetricCryptoSecuritySettings and AsymmetricCryptoSecuritySettings, carrying authorizeFileNotFoundError() and authorizeRecordNotFoundError() |
| — | Added: HceTimeProvider SPI (namespace calypso.card.spi) and CalypsoCardApiFactory.setHceTimeProvider(provider) |
| — | Added: CalypsoCard.getHceTokenExpiryLocalEpochSeconds() → Long? and isHceTokenValid() → Boolean?; SecuritySettings.authorizeExpiredHceToken(); State pre-condition on prepareOpenSecureSession (see Theme 15) |
| — | Added: CardRevocationStatusProvider SPI (namespace calypso.card.spi) and CalypsoCardApiFactory.setCardRevocationStatusProvider(provider) |
| — | Added: CalypsoCard.isRevoked() → Boolean?; SecuritySettings.authorizeRevokedCard(); second State pre-condition on prepareOpenSecureSession (see Theme 17) |
CalypsoCard.getTransactionCounter() → Int | → getTransactionCounter() → Int?; the State pre-condition requiring an open secure session is removed, and the value is fed by any Open Secure Session, the pre-opening performed during the selection included (see Theme 18) |
ChannelControl | Removed |
CardIOException, ReaderIOException, UnexpectedCommandStatusException, SelectFileException | Removed |
CardSignatureNotVerifiableException, CryptoException, CryptoIOException, InconsistentDataException, InvalidCardSignatureException, InvalidCertificateException, InvalidPinException, SessionBufferOverflowException, UnauthorizedKeyException | → same names without the Exception suffix |
A.4 Terminal Calypso Crypto Legacy SAM API (Java 1.0.0 → 2.0.0)
| Element in production | What it becomes |
|---|---|
LegacySamApiFactory.createSecuritySetting(), createKeyPairContainer(), createLegacyCardCertificateComputationData(), createBasicSignatureComputationData(), createTraceableSignatureComputationData(), createBasicSignatureVerificationData(), createTraceableSignatureVerificationData() | Removed (data classes) |
LegacySam.getProductType() → LegacySam.ProductType | → getProductType() → LegacySamProductType |
LegacySam.getCounter(int), getCounterCeiling(int) | Removed (use getCounters(), getCounterCeilings()) |
LegacySam.getCounterIncrementAccess(int) | → getCounterIncrementAccesses() → SortedMap<Int, CounterIncrementAccess> |
LegacySam.getSamParameters() → SamParameters | → getSamParameters() → ByteArray?; SamParameters removed |
LegacySam.getSystemKeyParameter(SystemKeyType) | → getSystemKeyParameters(systemKeyType) → KeyParameters? |
LegacySam.getWorkKeyParameter(int) / (byte, byte) | → getWorkKeyParametersByRecordNumber / getWorkKeyParametersByKifKvc |
| — | Added: LegacySam.getSystemKeyParametersRawData, getWorkKeyParametersRawDataByRecordNumber, getWorkKeyParametersRawDataByKifKvc, getKeyPair(commandId), getComputedCardCertificate(commandId), getSignature(commandId), getSignedData(commandId), isSignatureValid(commandId) |
LegacySam.ProductType | → LegacySamProductType |
KeyParameter (interface; getRawData, getParameterValue(int)) | → KeyParameters data class (kif, kvc, algorithm, parameterValues) |
LegacySamSelectionExtension.setUnlockData(String, ProductType) | → setUnlockDataForProductType(unlockData, productType) |
LegacySamSelectionExtension.setStaticUnlockDataProvider(provider) / setDynamicUnlockDataProvider(provider) | → setStaticUnlockDataProviderWithDeferredReader(provider) / setDynamicUnlockDataProviderWithDeferredReader(provider) |
LegacySamSelectionExtension.prepareReadWorkKeyParameters(int) / (byte, byte) | → prepareReadWorkKeyParametersByRecordNumber / prepareReadWorkKeyParametersByKifKvc |
LegacySamRevocationServiceSpi.isSamRevoked(byte[]) | Removed (isSamRevoked(serialNumber, counterValue: Int) remains) |
TransactionManager<T> and generic sub-interfaces | → non-generic, Self returns |
TransactionManager.processCommands(), processCommands(ChannelControl) | Removed (inherited CardTransactionManager.processCommands()) |
ReadTransactionManager.prepareReadWorkKeyParameters(int) / (byte, byte) | → …ByRecordNumber / …ByKifKvc |
FreeTransactionManager.prepareGenerateCardAsymmetricKeyPair(KeyPairContainer) | → prepareGenerateCardAsymmetricKeyPair(commandId: Int) |
FreeTransactionManager.prepareComputeCardCertificate(data) | → prepareComputeCardCertificate(commandId: Int, data) |
FreeTransactionManager / CardTransactionLegacySamExtension .prepareComputeSignature(data), .prepareVerifySignature(data) | → prepareComputeSignature(commandId: Int, data), prepareVerifySignature(commandId: Int, data) |
SecureWriteTransactionManager.prepareTransferWorkKeyDiversified(…, diversifier) | → prepareTransferWorkKeyDiversifiedWithSpecificDiversifier(…, diversifier) |
KeyPairContainer | Removed |
LegacyCardCertificateComputationData.setCardPublicKey, setStartDate, setEndDate, setCardAid, setCardSerialNumber, setCardStartupInfo | → properties of the data class: cardPublicKey, startDate, endDate, cardAid, cardSerialNumber, cardStartupInfo |
LegacyCardCertificateComputationData.getCertificate() | → LegacySam.getComputedCardCertificate(commandId: Int) → ByteArray? |
SignatureComputationData<T> | → sealed interface SignatureComputationData |
SignatureComputationData.setData(byte[] data, byte kif, byte kvc), setSignatureSize(int), setKeyDiversifier(byte[]) | → properties data, kif, kvc, signatureSize = 8, keyDiversifier: ByteArray? = null of the data classes |
SignatureComputationData.getSignature() | → LegacySam.getSignature(commandId: Int) → ByteArray? |
BasicSignatureComputationData, TraceableSignatureComputationData | → data classes implementing SignatureComputationData |
TraceableSignatureComputationData.withSamTraceabilityMode(int offset, SamTraceabilityMode mode), withoutBusyMode() | → properties traceabilityOffset = 0, samTraceabilityMode: SamTraceabilityMode? = null, busyMode = true |
TraceableSignatureComputationData.getSignedData() | → LegacySam.getSignedData(commandId: Int) → ByteArray? |
SignatureVerificationData<T> | → sealed interface SignatureVerificationData |
SignatureVerificationData.setData(byte[] data, byte[] signature, byte kif, byte kvc), setKeyDiversifier(byte[]) | → properties data, signature, kif, kvc, keyDiversifier: ByteArray? = null of the data classes |
SignatureVerificationData.isSignatureValid() | → LegacySam.isSignatureValid(commandId: Int) → Boolean? |
BasicSignatureVerificationData, TraceableSignatureVerificationData | → data classes implementing SignatureVerificationData |
TraceableSignatureVerificationData.withSamTraceabilityMode(int offset, SamTraceabilityMode mode, LegacySamRevocationServiceSpi service), withoutBusyMode() | → properties traceabilityOffset = 0, samTraceabilityMode: SamTraceabilityMode? = null, samRevocationService: LegacySamRevocationServiceSpi? = null, busyMode = true |
SecuritySetting.setControlSamResource(samReader, controlSam) | → LegacySamSecuritySettings data class (samReader, controlSam); securitySetting parameter → securitySettings in createSecureWriteTransactionManager and createAsyncTransactionCreatorManager |
ReaderIOException, SamIOException, UnexpectedCommandStatusException | Removed |
InconsistentDataException, InvalidSignatureException, SamRevokedException | → InconsistentData, InvalidSignature, SamRevoked |
A.5 Terminal Calypso Crypto Symmetric API (Java 0.1.1 → 0.2.0)
| Element in production | What it becomes |
|---|---|
SvCommandSecurityDataApi.getSvGetRequest(), getSvGetResponse(), getSvCommandPartialRequest() (inputs) | → svGetRequest, svGetResponse, svCommandPartialRequest parameters of computeSvCommandSecurityData |
SvCommandSecurityDataApi.setSerialNumber, setTransactionNumber, setTerminalChallenge, setTerminalSvMac (outputs) | → serialNumber, transactionNumber, terminalChallenge, terminalSvMac properties of the SvCommandSecurityData data class (namespace calypso.crypto.symmetric.spi) |
SymmetricCryptoCardTransactionManagerSpi.computeSvCommandSecurityData(SvCommandSecurityDataApi) → void | → computeSvCommandSecurityData(svGetRequest, svGetResponse, svCommandPartialRequest) → SvCommandSecurityData |
SymmetricCryptoCardTransactionManagerSpi.cipherPinForPresentation(…, Byte kif, Byte kvc), cipherPinForModification(…, Byte kif, Byte kvc) | → non-nullable kif: Byte, kvc: Byte |
SymmetricCryptoCardTransactionManagerFactorySpi.createCardTransactionManager(…, List<byte[]> transactionAuditData) | → exchangedApdus: MutableList<ByteArray> |
SymmetricCryptoException, SymmetricCryptoIOException | → SymmetricCrypto, SymmetricCryptoIO |
A.6 Terminal Calypso Crypto Asymmetric API (Java 0.2.0 → 0.3.0)
| Element in production | What it becomes |
|---|---|
CaCertificateContentSpi.getPublicKey, getPublicKeyReference, getStartDate, getEndDate, isAidTruncated, getAid, isCaCertificatesAuthenticationAllowed, isCardCertificatesAuthenticationAllowed | → properties of the CaCertificateContent data class: publicKey, publicKeyReference, startDate, endDate, isAidTruncated, aid: ByteArray?, isCaCertificatesAuthenticationAllowed, isCardCertificatesAuthenticationAllowed |
CaCertificateContentSpi.isAidCheckRequested() | Removed (deducible from aid, null if the check is not requested) |
CaCertificateSpi.checkCertificateAndGetContent(CaCertificateContentSpi) → CaCertificateContentSpi | → checkCertificateAndGetContent(issuerCertificateContent: CaCertificateContent) → CaCertificateContent |
PcaCertificateSpi.checkCertificateAndGetContent() → CaCertificateContentSpi | → … → CaCertificateContent |
CardCertificateSpi.checkCertificateAndGetPublicKey(CaCertificateContentSpi) → CardPublicKeySpi | → checkCertificateAndGetPublicKey(issuerCertificateContent: CaCertificateContent) → ByteArray |
CardPublicKeySpi (getRawValue) | Removed |
AsymmetricCryptoCardTransactionManagerSpi.initTerminalPkiSession(CardPublicKeySpi) | → initTerminalPkiSession(cardPublicKey: ByteArray) |
AsymmetricCryptoException, CertificateValidationException | → AsymmetricCrypto, CertificateValidation |
A.7 Terminal Generic Card API (Java 1.0.0 → 2.0.0)
| Element in production | What it becomes |
|---|---|
CardTransactionManager (extends the Reader API CardTransactionManager<…>) | → GenericCardTransactionManager (extends IsoCardTransactionManager) |
prepareApdu(String) | Removed |
prepareApdu(byte[]) | → prepareCommand(apdu: ByteArray) |
prepareApdu(byte cla, byte ins, byte p1, byte p2, byte[] dataIn, Byte le) | Removed |
| — | Added: prepareCommandWithId(commandId, apdu), prepareCommandWithMaxDuration(commandId, apdu, maxDurationUs), getLastExecutionResponse(commandId) → ByteArray? |
getResponsesAsByteArrays() | → getLastExecutionResponses() → List<ByteArray> |
getResponsesAsHexStrings() | Removed |
GenericCardApiFactory.createCardTransaction(reader, card) | → createGenericCardTransactionManager(reader, card) |
A.8 Terminal Storage Card API (Java 1.2.0 → 2.0.0)
| Element in production | What it becomes |
|---|---|
ProductType (methods getBlockCount, getBlockSize, hasSystemBlock, hasWriteAcknowledgment, hasAuthentication) | → StorageCardProductType with properties blockCount, blockSize, hasSystemBlock, hasWriteAcknowledgment, hasAuthentication |
StorageCardApiFactory.createStorageCardSelectionExtension(ProductType) | → productType: StorageCardProductType parameter |
StorageCard.getUID() | → getUid() |
StorageCard.getSystemBlock(), getBlock(int), getBlocks(int, int) | → ByteArray? returns |
StorageCardSelectionExtension / StorageCardTransactionManager .prepareMifareClassicAuthenticate(…, byte[] key) / (…, int keyNumber) | → prepareMifareClassicAuthenticateWithKey / prepareMifareClassicAuthenticateWithKeyNumber |
StorageCardTransactionManager (extends CardTransactionManager<…>) | → non-generic, Self returns |
StorageCardTransactionManager.prepareReadSystemBlock(), prepareWriteSystemBlock(byte[]) (deprecated) | Removed |
StorageCardTransactionManager.prepareSt25WriteSystemBlock(byte[]) | → prepareSt25WriteSystemBlock(commandId: Int, data: ByteArray) |
| — | Added: StorageCardSecuritySettings data class (readCommandMaxDurations); securitySettings parameter added to StorageCardApiFactory.createStorageCardTransactionManager(...) |
StorageCardTransactionManager.prepareWriteBlocks(int, byte[]) | → prepareWriteBlocks(commandId: Int, fromBlockAddress: Int, data: ByteArray) |
StorageCardException (getBlockAddress) | Removed; the errors carry blockAddress: Int? and commandId: Int? |
SCAuthenticationFailedException (extends CardCommunicationException) | → StorageCardAuthenticationFailed (no parent error) |
SCCardCommunicationException, SCInvalidCardResponseException, SCReaderCommunicationException | → StorageCardCardCommunication, StorageCardInvalidCardResponse, StorageCardReaderCommunication (parents unchanged) |
A.9 Terminal Reader Definitions API (new, 1.0.0)
| Element | Content |
|---|---|
ReaderDefinitionsApiProperties | VERSION constant |
RfTechnology | ISO_14443_AB, INNOVATRON_B_PRIME, FELICA, ISO_15693 |
CardType | ISO_7816_3, ISO_14443_4, ISO_14443_3A_MIFARE_CLASSIC_1K, ISO_14443_3A_MIFARE_CLASSIC_4K, ISO_14443_3A_MIFARE_ULTRALIGHT, ISO_14443_3B_ST25_SRT512, INNOVATRON_B_PRIME, FELICA, ISO_15693, UNKNOWN |
End of document.