calypsonet / calypso-card-analyzer

A free tool for analyzing and verifying the configuration of Calypso applications in cards.
https://calypsonet.org
Eclipse Public License 2.0
3 stars 0 forks source link

Can't execute card analyzer tool #3

Open NathanBnm opened 3 days ago

NathanBnm commented 3 days ago

I have an issue when executing the card analyzer tool. Here is my terminal output:

> java -jar Tool_AnalyzeCardFileStructure-2.0.3.jar
[09:09:30:053] [main] [INFO] SmartCardServiceAdapter - Register plugin [PcscPlugin]
Exception in thread "main" java.lang.IllegalStateException: Reader '.*(ASK.*|Identiv.*2|ACS ACR122U|SCR3310).*' not found in plugin 'PcscPlugin'
    at org.calypsonet.tool.calypso.common.ToolUtils.getCardReaderName(ToolUtils.java:55)
    at org.calypsonet.tool.calypso.card.Tool_AnalyzeCardFileStructure.initReaders(Tool_AnalyzeCardFileStructure.java:242)
    at org.calypsonet.tool.calypso.card.Tool_AnalyzeCardFileStructure.main(Tool_AnalyzeCardFileStructure.java:265)

Are there any prerequisites in order to be able to execute the script?

I'm running on macOS with OpenJDK 17.0.11

jeanpierrefortune commented 2 days ago

Hi Nathan,

The reader selection is based on the use of a regular expression applied to its name. As the exception log shows, the default value of this expression may not correspond to the name of your reader. If this is the case, you can replace the default value by passing another expression as a command line argument. If you only have one reader, this could be “.*”.

See https://github.com/calypsonet/calypso-card-analyzer?tab=readme-ov-file#using-the-calypso-card-analyzer-jar and https://github.com/calypsonet/calypso-card-analyzer/blob/b8da015798886ab1ab0a89fae533a476f1723a66/src/main/java/org/calypsonet/tool/calypso/card/Tool_AnalyzeCardFileStructure.java#L260

Keep us posted.

NathanBnm commented 2 days ago

Thanks for your help my card reader is now properly detected. Unfortunately I still get an exception while trying to read my Calypso card:

> java -jar Tool_AnalyzeCardFileStructure-2.0.3.jar ".*"
[10:51:12:987] [main] [INFO] SmartCardServiceAdapter - Register plugin [PcscPlugin]
[10:51:13:026] [main] [INFO] ToolUtils - Card reader, plugin; PcscPlugin, name: Generic Smart Card Reader Interface
[10:51:13:026] [main] [INFO] Tool_AnalyzeCardFileStructure - = Card Reader  NAME = Generic Smart Card Reader Interface
[10:51:13:657] [main] [WARN] Tool_AnalyzeCardFileStructure - Traceability information tag not available: A card command error occurred while processing responses to card commands: GET_DATA
Transaction audit JSON data: {"targetSmartCard":{"selectApplicationResponse":{"apdu":"6F228408334D54522E494341A516BF0C13C70800000000036D5D045307062801022012219000","statusWord":"9000"},"isExtendedModeSupported":false,"isRatificationOnDeselectSupported":false,"isSvFeatureAvailable":false,"isPinFeatureAvailable":true,"isPkiModeSupported":false,"isDfInvalidated":false,"calypsoCardClass":"LEGACY","calypsoSerialNumber":"00000000036D5D04","startupInfo":"06280102201221","productType":"PRIME_REVISION_2","dfName":"334D54522E494341","modificationsCounterMax":"06","isModificationCounterInBytes":false,"files":[],"filesBackup":[],"svLastTNum":"00","svLastTNumBackup":"00","isHce":false,"svKvc":"00","applicationSubType":"02","applicationType":"01","sessionModification":"06","payloadCapacity":"80","isCounterValuePostponed":false,"isLegacyCase1":false},"apdus":["94CA018500","6D00"]}
Exception in thread "main" org.eclipse.keypop.calypso.card.transaction.SelectFileException: File not found
    at org.eclipse.keyple.card.calypso.CommandSelectFile.parseResponse(CommandSelectFile.java:238)
    at org.eclipse.keyple.card.calypso.TransactionManagerAdapter.parseCommandResponse(TransactionManagerAdapter.java:240)
    at org.eclipse.keyple.card.calypso.TransactionManagerAdapter.executeCardCommands(TransactionManagerAdapter.java:207)
    at org.eclipse.keyple.card.calypso.FreeTransactionManagerAdapter.processCommands(FreeTransactionManagerAdapter.java:129)
    at org.eclipse.keyple.card.calypso.FreeTransactionManagerAdapter.processCommands(FreeTransactionManagerAdapter.java:28)
    at org.calypsonet.tool.calypso.card.Tool_AnalyzeCardFileStructure.getApplicationData(Tool_AnalyzeCardFileStructure.java:157)
    at org.calypsonet.tool.calypso.card.Tool_AnalyzeCardFileStructure.getApplicationsData(Tool_AnalyzeCardFileStructure.java:232)
    at org.calypsonet.tool.calypso.card.Tool_AnalyzeCardFileStructure.main(Tool_AnalyzeCardFileStructure.java:295)
Caused by: org.eclipse.keyple.card.calypso.CardDataAccessException: File not found
    at org.eclipse.keyple.card.calypso.Command.buildCommandException(Command.java:491)
    at org.eclipse.keyple.card.calypso.Command.checkStatus(Command.java:474)
    at org.eclipse.keyple.card.calypso.Command.setApduResponseAndCheckStatus(Command.java:390)
    at org.eclipse.keyple.card.calypso.CommandSelectFile.parseResponse(CommandSelectFile.java:236)
    ... 7 more

Is my card not supported by the analyzer tool?

jeanpierrefortune commented 1 day ago

Hi Nathan, The card may indeed have a file structure that's incompatible with the tool. Could you please give us the complete stacktrace, as we can't see the details of the origin of the problem here.