Thursday 2 July 2009

SCP02 sample applet

This thread on Sun JavaCard Forum has an excellent sample applet for anyone wanting to get started with SCP02. The nice thing about this applet is that you can encrypt and unencrypt APDUs (using the default keyset in this case), and can replay them against the applet to verify them.

Note that R-MAC and R-ENC are not supported by JCOP ...

Playing around with the PUT_KEY command in the sample applet (GP2.1.1 Specification 9.8, see also table 9-18), I can't get it work with my JCOP31 card from NXP - I always get "reference data not found" when trying to load a DES key. This happens even when using correct values for P1 on JCOP (0x01..0x6F according to this thread). Strangeness. Perhaps this only works when the APDU is sent directly to the SD (i.e. SD is selected) instead of accessing the SD via the applet.