Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [keyple-dev] Issue towards using UseCase4 & 10 with SAM-S1 E1

Dear Jean-Pierre,

I tried to adapt both of the examples and attached the Console log received.

The adaptation I made was to change the AID to "304554502E494341" and the SFI_ENVIRONMENT_AND_HOLDER to 0x14
(with UseCase10 used SFI_CONTRACTS as 0x15 but unsure about SFI_EVENTS_LOG and SFI_CONTRACT_LIST)

With that it seems it has progressed a bit more in either of the examples but I can't make it work to see it complete gracefully.

It seems to me that the card is not personalized on my side.

Could you confirm and guide me on the right example to start with ?

By the way, it is my first few days working with Calypso:
I see that although a bit of learning curve is required (atleast for me), Keyple is making it far more easier than I thought. Kudos to all of you.

Best regards,

Thillai Elayaraja S

   
Thillai Elayaraja S
CTO
+91 72593 34534
thillaielayaraja.s@xxxxxxxxxxx
 
ELYCTIS India Pte Ltd
Level 7, Mfar Greenheart
Manyata Tech Park
Bengaluru 560045
INDIA

On 04-07-2025 01:27 pm, Jean-Pierre Fortune wrote:

Hi Thillai,

Thanks for reaching out to the Keyple-Dev community and for providing these detailed logs.

Based on our analysis of the logs, the issue doesn't seem to be at the physical communication level. The exchanges between your reader and the card appear to be correct. The errors you're encountering are happening at a higher, application command level.

Specifically, in the log for UseCase10, the OPEN_SECURE_SESSION command fails with a 6A82 status word, which means "File not found". This command is trying to read record 1 of the file located by SFI (Short File Identifier) 0x06.

However, the JSON file generated by the card analysis tool shows that a file with SFI=0x06 does not actually exist on your card sample. This mismatch is the direct cause of the error.

This leads us to the main question: have you adapted the APDU commands in the examples to match the specific file structure of the card you are using?

It seems likely that adapting the SFI and record parameters within the commands to align with your card's actual file system should resolve the issue. The good news is that this suggests your reader is indeed capable of handling the low-level Calypso protocol correctly.

Let us know if adjusting the commands solves the problem.

Best regards,

Jean-Pierre Fortune

Keyple-Dev Team


Le ven. 4 juil. 2025 à 09:32, Thillai Elayaraja S via keyple-dev <keyple-dev@xxxxxxxxxxx> a écrit :

Dear Keyple-Dev team,

Good day! I'm Thillai Elayaraja, CTO of ELYCTIS. Currently I'm evaluating Calypso support with our PC/SC readers with a Calypso card sample + SAM acquired from ISRA.

The Calypso card sample is labelled as ST23ZR08 Calypso CD21 Rev 3.1 and
The SAM sample is labelled as INTEROP vFF.E0.42 SAM-S1 E1.

With them I tried the examples UseCase4 and UseCase10 from Keyple but encounter issues detailed below. I tried to adapt those examples to use the reader regex, Card AID (taken from the Card Configuration Audit tool) and also changed the LegacySamUtil.buildPowerOnDataFilter() to use LegacySam.ProductType.SAM_S1E1, with vain. I got to know from one of the CNA contacts to seek help from the Keyple-Dev community and that's where here I'am with the details given below:

Regarding the examples:

  • UseCase4_CardAuthentication:

    Attached the UseCase4_CardAuthentication.log for reference.

    For info, the code stopped at processCommands as below:


  • UseCase10_SessionTrace_TN313:

    Attached the UseCase10_SessionTrace_TN313.log for reference.

    For info, the log ends with the following error:

    [11:01:01:138] [pool-1-thread-1] [ERROR] CardReaderObserver - [Transaction failed with exception: A card command error occurred while processing responses to card commands: OPEN_SECURE_SESSION
    Transaction audit JSON data: {"targetSmartCard":{"selectApplicationResponse":{"apdu":"6F228408334D54522E494341A516BF0C13C70800000000750D264E53070A2D20021010019000","statusWord":"9000"},"isExtendedModeSupported":false,"isRatificationOnDeselectSupported":true,"isSvFeatureAvailable":false,"isPinFeatureAvailable":false,"isPkiModeSupported":false,"isDfInvalidated":false,"calypsoCardClass":"ISO","calypsoSerialNumber":"00000000750D264E","startupInfo":"0A2D2002101001","productType":"PRIME_REVISION_3","dfName":"334D54522E494341","modificationsCounterMax":"01AE","isModificationCounterInBytes":true,"files":[],"filesBackup":[],"svLastTNum":"00","svLastTNumBackup":"00","isHce":false,"svKvc":"00","applicationSubType":"02","applicationType":"20","sessionModification":"0A","payloadCapacity":"FA","isCounterValuePostponed":false,"isLegacyCase1":false},"apdus":["008A0B3904AF711A9400","6A82"]}

    [11:01:01:138] [pool-1-thread-1] [INFO] ObservableLocalReaderAdapter - Reader [ELYCTIS CL reader FFFFFFFF0000 0] starts card removal sequence

Regarding Card Configuration Audit tools:
  • Attached the Tool_AnalyzeCardFileStructure-2.0.3.log and the generated 20250626_CardData_1963796046.json for reference.

  • Attached the Tool_CheckCardFileStructure-2.0.3.log for reference.

With these logs and info, could you help if I need to adapt the examples further to verify the intended use-cases ? And can we "tentatively" say if our reader is capable to support Calypso transactions ?

Thanking you.

With best regards,

Thillai Elayaraja S

P S : Soon we will try to procure the test kits from CNA to validate our readers with all usecases and with the demonstrator app.

--
   
Thillai Elayaraja S
CTO
+91 72593 34534
thillaielayaraja.s@xxxxxxxxxxx
 
ELYCTIS India Pte Ltd
Level 7, Mfar Greenheart
Manyata Tech Park
Bengaluru 560045
INDIA

_______________________________________________
keyple-dev mailing list
keyple-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/keyple-dev
[main] INFO org.eclipse.keyple.card.calypso.example.UseCase10_SessionTrace_TN313.Main_SessionTrace_TN313_Pcsc - =============== UseCase Calypso #10: session trace TN313 ==================
[main] INFO org.eclipse.keyple.card.calypso.example.UseCase10_SessionTrace_TN313.Main_SessionTrace_TN313_Pcsc - Using parameters:
[main] INFO org.eclipse.keyple.card.calypso.example.UseCase10_SessionTrace_TN313.Main_SessionTrace_TN313_Pcsc -   AID=304554502E494341
[main] INFO org.eclipse.keyple.card.calypso.example.UseCase10_SessionTrace_TN313.Main_SessionTrace_TN313_Pcsc -   CARD_READER_REGEX=.*ASK LoGO.*|.*Contactless.*|.*ELYCTIS CL .*
[main] INFO org.eclipse.keyple.card.calypso.example.UseCase10_SessionTrace_TN313.Main_SessionTrace_TN313_Pcsc -   SAM_READER_REGEX=.*Identive.*|.*HID.*|.*SAM.*|.*ELYCTIS CNT .*
[main] INFO org.eclipse.keyple.core.service.SmartCardServiceAdapter - Register plugin [PcscPlugin]
[main] INFO org.eclipse.keyple.plugin.pcsc.PcscPluginAdapter - Plugin [PcscPlugin]: use default protocol identification rules
[main] INFO org.eclipse.keyple.plugin.pcsc.PcscPluginAdapter - Plugin [PcscPlugin]: search available readers
[main] INFO org.eclipse.keyple.plugin.pcsc.PcscPluginAdapter - Plugin [PcscPlugin]: reader found: [ELYCTIS CL reader FFFFFFFF0000 0]
[main] INFO org.eclipse.keyple.plugin.pcsc.PcscPluginAdapter - Plugin [PcscPlugin]: reader found: [ELYCTIS CNT reader FFFFFFFF0000 0]
[main] INFO org.eclipse.keyple.plugin.pcsc.PcscReaderAdapter - Reader [ELYCTIS CL reader FFFFFFFF0000 0]: set contactless type to [true]
[main] INFO org.eclipse.keyple.plugin.pcsc.PcscReaderAdapter - Reader [ELYCTIS CL reader FFFFFFFF0000 0]: set ISO protocol to [T1] (T=1)
[main] INFO org.eclipse.keyple.plugin.pcsc.PcscReaderAdapter - Reader [ELYCTIS CL reader FFFFFFFF0000 0]: set sharing mode to [SHARED]
[main] INFO org.eclipse.keyple.plugin.pcsc.PcscReaderAdapter - Reader [ELYCTIS CNT reader FFFFFFFF0000 0]: set contactless type to [false]
[main] INFO org.eclipse.keyple.plugin.pcsc.PcscReaderAdapter - Reader [ELYCTIS CNT reader FFFFFFFF0000 0]: set ISO protocol to [ANY] (*)
[main] INFO org.eclipse.keyple.plugin.pcsc.PcscReaderAdapter - Reader [ELYCTIS CNT reader FFFFFFFF0000 0]: set sharing mode to [SHARED]
[main] INFO org.eclipse.keyple.card.calypso.example.UseCase10_SessionTrace_TN313.Main_SessionTrace_TN313_Pcsc - Select application with AID = '304554502E494341'
[main] INFO org.eclipse.keyple.core.service.ObservationManagerAdapter - Reader [ELYCTIS CL reader FFFFFFFF0000 0] adds observer [CardReaderObserver]
[main] INFO org.eclipse.keyple.core.service.ObservableLocalReaderAdapter - Reader [ELYCTIS CL reader FFFFFFFF0000 0] starts card detection with polling mode [REPEATING]
[main] INFO org.eclipse.keyple.card.calypso.example.UseCase10_SessionTrace_TN313.Main_SessionTrace_TN313_Pcsc - Wait for a card...
[main] INFO org.eclipse.keyple.card.calypso.example.UseCase10_SessionTrace_TN313.Main_SessionTrace_TN313_Pcsc - Press ENTER to exit...
[pool-1-thread-1] WARN org.eclipse.keyple.card.calypso.CommandCloseSecureSession - Failed to abort secure session: No session was opened
[pool-1-thread-1] ERROR org.eclipse.keyple.card.calypso.example.UseCase10_SessionTrace_TN313.CardReaderObserver - Transaction failed with exception: A card command error occurred while processing responses to card commands: CLOSE_SECURE_SESSION
Transaction audit JSON data: {"targetSmartCard":{"selectApplicationResponse":{"apdu":"6F228408304554502E494341A516BF0C13C70800000000750D264E53070A2D20021010019000","statusWord":"9000"},"isExtendedModeSupported":false,"isRatificationOnDeselectSupported":true,"isSvFeatureAvailable":false,"isPinFeatureAvailable":false,"isPkiModeSupported":false,"isDfInvalidated":false,"calypsoCardClass":"ISO","calypsoSerialNumber":"00000000750D264E","startupInfo":"0A2D2002101001","productType":"PRIME_REVISION_3","dfName":"304554502E494341","modificationsCounterMax":"01AE","isModificationCounterInBytes":true,"files":[{"sfi":"14","data":{"records":{"01":"0000000000000000000000000000000000000000000000000000000000"}}},{"sfi":"15","data":{"records":{"01":"0000000000000000000000000000000000000000000000000000000000"}}}],"filesBackup":[],"currentEf":{"sfi":"14","data":{"records":{"01":"0000000000000000000000000000000000000000000000000000000000"}}},"isDfRatified":true,"transactionCounter":"030CFF","svLastTNum":"00","svLastTNumBackup":"00","isHce":false,"svKvc":"00","applicationSubType":"02","applicationType":"20","sessionModification":"0A","payloadCapacity":"FA","isCounterValuePostponed":false,"isLegacyCase1":false},"apdus":["008A0BA90494D260AE00","030CFF2500FF411D00000000000000000000000000000000000000000000000000000000009000","00B201A41D","00000000000000000000000000000000000000000000000000000000009000","801400000800000000750D264E","9000","808A00FF273041030CFF2500FF411D0000000000000000000000000000000000000000000000000000000000","9000","808C00000500B201A41D","9000","808C00001F00000000000000000000000000000000000000000000000000000000009000","9000","808E000004","02CFED849000","008E00000402CFED8400","6988"]}
[pool-1-thread-1] INFO org.eclipse.keyple.core.service.ObservableLocalReaderAdapter - Reader [ELYCTIS CL reader FFFFFFFF0000 0] starts card removal sequence
[15:40:36:410] [main] [INFO] Main_CardAuthentication_Pcsc - = UseCase Calypso #4: Calypso card authentication ==================
[15:40:36:491] [main] [INFO] SmartCardServiceAdapter - Register plugin [PcscPlugin]
[15:40:36:522] [main] [INFO] PcscPluginAdapter - Plugin [PcscPlugin]: use default protocol identification rules
[15:40:36:528] [main] [INFO] PcscPluginAdapter - Plugin [PcscPlugin]: search available readers
[15:40:37:429] [main] [INFO] PcscPluginAdapter - Plugin [PcscPlugin]: reader found: [ELYCTIS CL reader FFFFFFFF0000 0]
[15:40:37:429] [main] [INFO] PcscPluginAdapter - Plugin [PcscPlugin]: reader found: [ELYCTIS CNT reader FFFFFFFF0000 0]
[15:40:37:447] [main] [INFO] PcscReaderAdapter - Reader [ELYCTIS CL reader FFFFFFFF0000 0]: set contactless type to [true]
[15:40:37:447] [main] [INFO] PcscReaderAdapter - Reader [ELYCTIS CL reader FFFFFFFF0000 0]: set ISO protocol to [T1] (T=1)
[15:40:37:447] [main] [INFO] PcscReaderAdapter - Reader [ELYCTIS CL reader FFFFFFFF0000 0]: set sharing mode to [SHARED]
[15:40:37:447] [main] [INFO] PcscReaderAdapter - Reader [ELYCTIS CNT reader FFFFFFFF0000 0]: set contactless type to [false]
[15:40:37:447] [main] [INFO] PcscReaderAdapter - Reader [ELYCTIS CNT reader FFFFFFFF0000 0]: set ISO protocol to [ANY] (*)
[15:40:37:447] [main] [INFO] PcscReaderAdapter - Reader [ELYCTIS CNT reader FFFFFFFF0000 0]: set sharing mode to [SHARED]
[15:40:37:460] [main] [DEBUG] PcscReaderAdapter - Reader [ELYCTIS CNT reader FFFFFFFF0000 0]: open card physical channel for protocol [*]
[15:40:37:468] [main] [DEBUG] PcscReaderAdapter - Reader [ELYCTIS CNT reader FFFFFFFF0000 0]: open card physical channel in shared mode
[15:40:37:475] [main] [DEBUG] PcscReaderAdapter - Reader [ELYCTIS CL reader FFFFFFFF0000 0]: open card physical channel for protocol [T=1]
[15:40:37:480] [main] [DEBUG] PcscReaderAdapter - Reader [ELYCTIS CL reader FFFFFFFF0000 0]: open card physical channel in shared mode
[15:40:37:480] [main] [DEBUG] LocalReaderAdapter - Reader [ELYCTIS CL reader FFFFFFFF0000 0] selects application with AID [304554502E494341]
[15:40:37:489] [main] [DEBUG] LocalReaderAdapter - Reader [ELYCTIS CL reader FFFFFFFF0000 0] --> apduRequest: APDU_REQUEST = {"apdu":"00A4040008304554502E49434100","successfulStatusWords":["9000"],"info":"Internal Select Application"}, elapsed 2.925586168E8 ms
[15:40:37:503] [main] [DEBUG] LocalReaderAdapter - Reader [ELYCTIS CL reader FFFFFFFF0000 0] <-- apduResponse: APDU_RESPONSE = {"apdu":"6F228408304554502E494341A516BF0C13C70800000000750D264E53070A2D20021010019000","statusWord":"9000"}, elapsed 20.8 ms
[15:40:37:510] [main] [DEBUG] CommandGetDataFci - DF name: 304554502E494341
[15:40:37:510] [main] [DEBUG] CommandGetDataFci - Application serial number: 00000000750D264Eh
[15:40:37:510] [main] [DEBUG] CommandGetDataFci - Discretionary data: 0A2D2002101001
[15:40:37:524] [main] [DEBUG] LocalReaderAdapter - Reader [ELYCTIS CNT reader FFFFFFFF0000 0] --> apduRequest: APDU_REQUEST = {"apdu":"8084000004","successfulStatusWords":["9000"],"info":"Get Challenge"}, elapsed 2.925586597E8 ms
[15:40:37:531] [main] [DEBUG] LocalReaderAdapter - Reader [ELYCTIS CNT reader FFFFFFFF0000 0] <-- apduResponse: APDU_RESPONSE = {"apdu":"409737D59000","statusWord":"9000"}, elapsed 7.3 ms
[15:40:37:533] [main] [DEBUG] LocalReaderAdapter - Reader [ELYCTIS CL reader FFFFFFFF0000 0] --> apduRequest: APDU_REQUEST = {"apdu":"008A0BA104409737D500","successfulStatusWords":["9000"],"info":"Open Secure Session - key index: 3, sfi: 14h, rec: 1"}, elapsed 30.7 ms
[15:40:37:548] [main] [DEBUG] LocalReaderAdapter - Reader [ELYCTIS CL reader FFFFFFFF0000 0] <-- apduResponse: APDU_RESPONSE = {"apdu":"030D067E00FF411D00000000000000000000000000000000000000000000000000000000009000","statusWord":"9000"}, elapsed 15.3 ms
[15:40:37:551] [main] [DEBUG] LocalReaderAdapter - Reader [ELYCTIS CL reader FFFFFFFF0000 0] --> apduRequest: APDU_REQUEST = {"apdu":"008E000000","successfulStatusWords":["9000"],"info":"Close Secure Session"}, elapsed 2.8 ms
[15:40:37:556] [main] [DEBUG] LocalReaderAdapter - Reader [ELYCTIS CL reader FFFFFFFF0000 0] <-- apduResponse: APDU_RESPONSE = {"apdu":"9000","statusWord":"9000"}, elapsed 5.3 ms
[15:40:37:556] [main] [INFO] CommandCloseSecureSession - Secure session successfully aborted
Exception in thread "main" org.eclipse.keypop.calypso.card.transaction.UnauthorizedKeyException: Unauthorized key error: KIF=null, KVC=41h
	at org.eclipse.keyple.card.calypso.CommandOpenSecureSession.synchronizeCryptoService(CommandOpenSecureSession.java:434)
	at org.eclipse.keyple.card.calypso.CommandOpenSecureSession.parseResponse(CommandOpenSecureSession.java:496)
	at org.eclipse.keyple.card.calypso.TransactionManagerAdapter.parseCommandResponse(TransactionManagerAdapter.java:239)
	at org.eclipse.keyple.card.calypso.TransactionManagerAdapter.executeCardCommands(TransactionManagerAdapter.java:206)
	at org.eclipse.keyple.card.calypso.SecureSymmetricCryptoTransactionManagerAdapter.processCommands(SecureSymmetricCryptoTransactionManagerAdapter.java:302)
	at org.eclipse.keyple.card.calypso.SecureSymmetricCryptoTransactionManagerAdapter.processCommands(SecureSymmetricCryptoTransactionManagerAdapter.java:39)
	at org.eclipse.keyple.card.calypso.example.UseCase4_CardAuthentication.Main_CardAuthentication_Pcsc.main(Main_CardAuthentication_Pcsc.java:148)

Back to the top