1
votes

I've got a contactless chip card (not bank or SIM) which I can interact by NFC channel (ISO14443, ISO 7816 Part 4).

All I want to get from this card is getting of UID of the card, which can help me to differ one card from others. As I understand this is PAN value which I can get under the tag '5A'.

Firstly, I can send this command to the card

00:a4:04:00:0e:32:50:41:59:2e:53:59:53:2e:44:44:46:30:31:00

and get positive answer (SW:9000) with the AID value.

So, I have AID and I can send such command

00:a4:04:00:LеnAID:<AID>:00

to open file for reading TLV-based info under different Tag, am I right?

But when I send ('5A' - tag for PAN)

00:CA:00:5A:00

I have bad response -> 6E:00

So,

1)Should I change Class value (CLA = 00 for right now)? And for what value?

2)Maybe I have to change INS value for READ RECORD (B0 or B2 or something else) because "The kernel uses the value of the AFL (i.e. tag ‘94’) to issue one or more READ RECORD commands retrieve the Application data elements", in my case tag '5A' for PAN. If so, what the complete workflow should be for getting PAN?

UPD. When I sent

ff:ca:00:00:00

I receive

6e:00
1
If you mean contactless UID than have a look here. PAN/PAN Sequence number is very specific for EMV payment cards. Good luck!vlp
The term UID suggests a precision, which simply does not exists in smart cards in general. It wholly depends on the card in question, which you did not specify. For a start see this question.guidot
@vlp ff:ca:00:00:00 didn't fit to me, I received 6e:00. Maybe this is that my card is not payment card but more like a tokenAlex Zezekalo
@vlp Hmmm, tried to get info from my Mastercard with Paypass. The same answer, 6E:00, it's strange for meAlex Zezekalo
@AlexZezekalo I have just send FF CA 00 00 00 command to a Mastercard credit card and I got the UID of the card. What card and reader are you using? If the card is ISO 14443 you can use this command to get the UID. It is defined in PCSC extensions for contactless. Do you get an "ATR" when you tap your card to the your reader? You can check PCSC specs to identify which type of card you are using.jlanza

1 Answers

2
votes

For unknown for me reason I couldn't get positive answer on command

FF:CA:00:00:00

I got answer 6E:00

But I found another way how to get card info. I have to execute not one but a sequence of commands:

1) Firstly I have to find out the AID of the applet. If you know AID you can skip this step (2PAY.SYS.DDF in my case)

00:a4:04:00:0e:32:50:41:59:2e:53:59:53:2e:44:44:46:30:31:00

2) Then SELECT APPLICATION

00 A4 04 00 AID-Lenth AID

3) After that we GET PROCESSING OPTIONS

80 A8 00 00 02 83 00 00

4) And READ RECORD

00 B2 01 14 00

For decoding TLV-response I use this utility - https://www.emvlab.org/tlvutils In response I got not only 5A tag but also others and for right now I have to parse the whole R-APDU for fetching particular tag value.

Is there any java-libs for parsing TLV-response?