javacard

JavaCard 3.2 SCP key not found


I'm trying to start the JavaCard HelloWorld project on simulator 3.2 but I always get the exception

Executing:

C:\DEV\Java\java_card_devkit\v25\java_card_devkit_simulator-win-bin-v25.0-b_474-23-APR-2025\runtime\bin\jcsw.exe -p=9025 
START command completed successfully at 2025-05-29 21:51:43.034
Exception in thread "Thread-360" **java.util.NoSuchElementException: SCP Key "_scp03mac_10" not found in properties. Use <AID>_[scp02|scp03][mac|enc|dek][_<key-version>]**
    at com.oracle.javacard.amservice/com.oracle.javacard.ams.gp.scp.SCPHelper.getKey(SCPHelper.java:272)
    at com.oracle.javacard.amservice/com.oracle.javacard.ams.gp.scp.SCP03.createSessionKeys(SCP03.java:84)
    at com.oracle.javacard.amservice/com.oracle.javacard.ams.gp.scp.SCP03.authenticateCard(SCP03.java:238)
    at com.oracle.javacard.amservice/com.oracle.javacard.ams.gp.operations.GPOpenSecureChannel.initUpdate(GPOpenSecureChannel.java:137)

but I choose this config file enter image description here

that contains:

A000000151000000_scp03enc_10=1111111111111111111111111111111111111111111111111111111111111111 
A000000151000000_scp03mac_10=2222222222222222222222222222222222222222222222222222222222222222 
A000000151000000_scp03dek_10=3333333333333333333333333333333333333333333333333333333333333333

and I've initialized with this:

java -jar %JC_HOME_SIMULATOR%\tools\Configurator.jar \
  -binary %JC_HOME_SIMULATOR%\runtime\bin\jcsw.exe \
  -SCP-keyset 10 1111111111111111111111111111111111111111111111111111111111111111 2222222222222222222222222222222222222222222222222222222222222222 3333333333333333333333333333333333333333333333333333333333333333 \
  -global-pin 01020304050f 03

So my question is where is where is defined SCP Key _scp03mac_10?


Solution

  • Apparently the prefix for the Card manager AID is missing, which is out before the underscore of the key name. It is either one starting with A000000003 or A000000151 (the 5-byte RID) for the old implementation and new implementations respectively.

    Maybe the Configator could not decide between the two, which means you have to provide it yourself using the parameter: -cardManagerAid A000000151000000.