Select Java Card Applet and return 0x61XX rather than 0x9000

Viewed 139

I would like my java card applet to emulate our legacy non-java card (native OS) in our organization. The following is the targeted behaviour of the applet:

  1. Select the applet (A4) and return 0x61XX.
  2. Use GET RESPONSE (C0) to read the response

Protocol is T1.

My sample java card is from NXP compatible with JCRE 2.2.2. In my code,

//dataLen is 10 bytes

if (selectingApplet()){ apdu.setOutgoing();

apdu.setOutgoingLength((short)dataLen);
apdu.sendBytesLong(data, (short)0, dataLen);
ISOException.throwIt((short)(ISO7816.SW_BYTES_REMAINING_00 + dataLen)

}

I loaded my applet into the test card. The following is the result:

  1. Select applet Result: 0x610A

  2. GET RESPONSE Result: 0x6982

What could be wrong here ? What is the proper way of achieving this if this is even possible with java card ?

1 Answers

I don't think this is possible. The differences between T=0 and T=1 are handled by the Java card framework. GET RESPONSE is specific to T=0.

That means that the 61XX would be generated automatically when using T=0. And of course that the response of SELECT for INSTALL should be automatically returned - unless if the applet thrown an exception that generates a status word, in which case it is likely disregarded.

Similarly, I would expect the framework to catch the GET RESPONSE early, before you can do anything with it. The only thing you could try is to handle the GET RESPONSE yourself and hope the OS passes the APDU along.

But I think the best way of doing this is to configure the chip to use T=0. Then ISO case 4 commands (response and command data) should automatically use GET RESPONSE.

Related