Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strange Invalid CLA command (6E 00) on Java SmartCard IO

I am writing a smart card application and after a successful selection of the application with its AID, when it gets to sending Get Processing Options

I get 6E 00 as response - Invalid CLA command. This is part of the code that sends the command and receive the response:

ResponseAPDU rapdu = sendCommand(new byte[]{(byte)0x80, (byte)0xA8, (byte)0x00, (byte)0x00, (byte)0x02, (byte)0x83, (byte)0x00, (byte)0x00});

private ResponseAPDU sendCommand(byte[] apdu) throws CardException{
    CommandAPDU capdu = new CommandAPDU(apdu);         
    ResponseAPDU rpd = channel.transmit(capdu);

    return rpd;
}

I am using the same command to read the card using Jaccal library and it's working perfectly, but it's just that jaccal is not appropriate for my application because of it's use of external dll file. I don't know why it's giving me this kind of response.

like image 231
Olantobi Avatar asked Dec 08 '11 18:12

Olantobi


1 Answers

A number of blog/forum entries discuss this issue:

  • http://ridrix.wordpress.com/2009/07/12/design-error-in-javax-smartcardio/
  • http://vs-page.blogspot.co.uk/2010/06/problems-while-executing-transmit.html
  • https://forums.oracle.com/forums/thread.jspa?threadID=2341950&start=15&tstart=0

In my case VISA cards appear to be "forgiving", but MasterCards are not (6E 00). Note, contrary to advice, upgrading to Java 7 didn't fix it for me. You're probably looking at the sun.security.smartcardio.t0GetResponse solution and handling responses.

I did the following to get it working:

System.setProperty("sun.security.smartcardio.t0GetResponse", "false");

Handle responses with GET RESPONSE (see EMV 4.3 Book 1, Section 9.3.1.3). This link is also useful:

  • http://blog.saush.com/2006/09/08/getting-information-from-an-emv-chip-card/
like image 102
Corin Fletcher Avatar answered Oct 22 '22 16:10

Corin Fletcher