0

I am trying to read data from sony felica card using pc/sc transparent session and transceive data object.

The response I am getting is for a read without encryption command is

c0 03 00 90 00 92 01 00 96 02 00 00 97 82 00 + Data

But according to the protocol, the response should be

c0 03 00 90 00 92 01 00 96 02 00 00 97 + Data

I am unable to figure out the last 82 00 appended in the response from the card.

Now when I try to authenticate with the card I get

c0 03 01 6F 01 90 00

which is a error in pc/sc. I want to resolve these extra bytes 82 00 which I believe will solve the issue with all the commands which require authentication and encryption.

Aditya_Anand
  • 525
  • 7
  • 17

1 Answers1

1

The response data is BER-TLV encoded (see PC/SC 2.02, Part 3).

In BER-TLV encoding there are several possibilities to encode tag 0x97 with two octets of data 0xD0D1, e.g.:

  • 97|02|D0D1 -- short form (see parsed)

  • 97|8102|D0D1 -- long form with one octet with length (see parsed)

  • 97|820002|D0D1 -- long form with two octets with length (see parsed)

  • 97|83000002|D0D1 -- long form with three octets with length (see parsed)

  • ...

Your reader is using two octets for sending the length of ICC Response data object (which is perfectly valid).

You should parse the response properly...Good luck!

PS: The above means, that the Data part of your truncated responses still contains one extra byte with the response length (i.e. Len|Data)

vlp
  • 7,811
  • 2
  • 23
  • 51
  • yes, you are right but then why only the mutual auth command is failing for felica? – Aditya_Anand Apr 20 '17 at 23:18
  • Could you update your question with a complete APDU trace? And which reader are you using (as 6F01 is not defined by PC/SC -- the nearest one is `XX 6F 00` -- *Data object XX failed, no precise diagnosis*)? – vlp Apr 21 '17 at 12:56