Search code examples
smartcardapdu

APDU Command for same Personal ID card returns different response on different readers


I am trying to read Personal ID card on contactless card reader. I have done code in Java for USB Gemalto reader where I`m able to read basic stuff - such as Auth Certificate/Sign in Certificate.

When I perform same set of APDU commands on contactless, I get different responses and unable to read the certificate.

After successful select and getting ATR, I`m sending following commands:

  • command 1:{ 0x00, (byte)0xa4, 0x04, 0x0c, 0x0e, (byte)0xe8, 0x28, (byte)0xbd, 0x08, 0x0f, (byte)0xd0, 0x08, 0x44, 0x55, 0x41, 0x4c, 0x65, 0x49, 0x44 }
  • command2: { 0x00, 0xa4, 0x02, 0x0c, 0x02, 0x00, 0x12, 0x00 }
  • command3: { 0x00, 0xb0, 0x00, 0x00, 0x00, 0x03, 0x80 }
  • command4: { 0x00, 0xb0, 0x03, 0x80, 0x00, 0x03, 0x80 }

On contactless reader, command 3 and command 4 return apdu response 69 82, suggesting security conditions are not met.

Is there any difference between reading chip contact/contactless which prevents me from getting successful response on last 2 commands?


Solution

  • There is a pretty sophisticated mechanism in ISO 7816-4, which allows access rules to be specific to the communication interface. It would be easy, to code a rule, which rejects the Read Binary on contact interface (the ISO-term is transport type descriptor), but this is an untypical use - one would expect more restrictions on the contactless side.

    On the other hand, your example is an extended length APDU, which the card as well as the reader have to support for contact-based interface. Of course 67 00 would be a more helpful status for that scenario, but... I would try shorter response LE (i. e. a single byte) for confirmation.