Search code examples
apismartcardjavacardglobalplatform

Javacard J2A040 not support glabalplatform from javacardos?


As it is the first time that I use globalplatform with javacardos (JCIDE), I noticed that I could not download the applet when in the code I put:

private void processGetCardStatus(APDU apdu) { 
        byte[] buffer = apdu.getBuffer();           
        short le = apdu.setOutgoing();
        
        if ( le < (byte)1 )
           ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);
        
        apdu.setOutgoingLength( (byte)1);
        buffer[0] = (byte)GPSystem.getCardState();
        
        apdu.sendBytes((short)0, (short)1);
    }

Downloading cap file with PyApduTool give me an error:

Download Cap error: Download cap file failed. Send: 80 E8 00 00 F0 C4 82 04 29 01 00 1B DE CA FF ED 02 02 04 00 01 05 01 02 03 04 05 0B 6D 6F 6E 70 61 63 6B 61 67 65 32 02 00 21 00 1B 00 21 00 0A 00 1E 00 7E 00 14 02 AE 00 0A 00 60 00 00 01 19 09 6E 00 00 00 00 00 00 03 01 00 04 00 1E 03 03 01 07 A0 00 00 00 62 01 01 07 01 06 A0 00 00 01 51 00 00 01 07 A0 00 00 00 62 00 01 03 00 0A 01 06 01 02 03 04 05 00 00 64 06 00 14 00 00 00 80 03 03 00 02 04 04 00 00 00 7D FF FF 00 70 00 85 07 02 AE 00 05 43 18 8C 00 18 18 10 40 04 8D 00 05 87 00 18 8F 00 03 3D 06 10 08 8C 00 04 87 01 19 1E 25 29 04 1E 16 04 41 04 41 31 19 1E 25 29 05 1E 16 05 41 04 41 31 19 1E 25 29 06 19 1E 04 41 AD 00 03 16 06 8D 00 06 3B 18 8F 00 03 3D 06 10 08 8C 00 04 87 01 AD 01 19 1E 04 41 16 06 8B 00 07 18 8B 00, Recv: 6A 80.

but when i comment the line from code above, i can download the CAP file:

//buffer[0] = (byte)GPSystem.getCardState();

i use GlobalPlatform API 1.7, my card is J2A040, based, JCOP 2.4.1, JC 2.2.2, GP 2.1.1., T=1, SCP02

On top of code i have

import org.globalplatform.GPSystem;

Where is the problem, is it coming from the API version?

Thanks for your response.


Solution

  • Problem, resolved. it's because on JCIDE Javacardos, i need to add jar container, by select package, click right, properties, Libray Option, and click button Add Jar Container, and select Global Platform 2.1.1