Skip to Main Content

Java Card

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

javax.smartcardio incompatible with EMV cards (bug or design error)?

843851Jun 13 2009 — edited Jul 1 2009
Has anyone here tried using javax.smartcardio with EMV cards?

I just hit a problem that makes me believe there is a bug or design error in smartcardio.

When SmartcardIO recieves the procedure bytes 61xx, it issues a GET RESPONSE-command with the class byte from the previous "main" command. This conflics with the EMV specifications.

Here's my problem:

When you send commands to an EMV card, the card usually responds by sending procedure bytes (SW1SW2 = 61xx or 6Cxx). These bytes should (according to 7816 and EMV spec) be handled by the TTL (Terminal Transport Layer, eg the smartcardIO API), and not by the TAL (Terminal Application Layer, eg your code).
And smartcardio does this. So far so good. But the problem occurs when I issue the EMV command "GET PROCESSING OPTIONS".
This command has CLA=0x80 and INS=0xA8. When the TTL (that is, the smartcardio API) recieves the procedure bytes 61xx, SmartcardIO issues the GET RESPONSE command with CLA=0x80 and INS=0xC0, however the EMV specs clearly states that this command must use CLA=0x00. SmartcardIO uses the CLA of the main command (GET PROCESSING OPTS) when issuing the GET RESPONSE command. Some EMV cards ignore the value of the CLA-byte at this stage, but others are not so forgiving.

Look here at lines 198-210:
[https://openjdk.dev.java.net/source/browse/openjdk/jdk/trunk/jdk/src/share/classes/sun/security/smartcardio/ChannelImpl.java?annotate=257]

I've tried reading the 7816-4 specs about the GET RESPONSE-command:
[http://www.ttfn.net/techno/smartcards/iso7816_4.html#ss7_1_1]
but it doesn't state specifically that the GET RESPONSE command should use the CLASS byte of the "main" command.

Am I missing something, or is this a design error in smartcardio?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 29 2009
Added on Jun 13 2009
1 comment
343 views