APDU command to get smart card uid
Asked Answered
S

2

12

i am looking for APDU to find UID of contact less ISO 14443 smart card and how to use it to print in Linux terminal. Problem is that i found many people talking about it, but there is no solution. Can anyone help is this regard??? Thanks

Stigmasterol answered 24/10, 2012 at 14:19 Comment(0)
E
6

See the other answer, it is likely that most readers do support the pass through to the card reader by now.


Nobody can help as the UID is specified in the ISO 14443 T=CL transport protocol while APDU's are specified in the ISO 7816 application layer protocol.

So you need access to a lower level API for your contactless reader. PCSC will not suffice (unless there has been a pass through implemented for the specific reader that returns the UID).

Electioneer answered 24/10, 2012 at 15:44 Comment(5)
So, what could be the possible way to read UID of smart card while working with PCSC-Lite?Stigmasterol
I would have a look at the underlying reader libraries. PCSC was initially made for contact readers anyway. Problem is that anything beyond PCSC is likely to be proprietary drivers.Electioneer
Does UID is specific per every contact-less card in world? (i.e. isn't there two different cards with equal UID?) Is it fixed or it is a random number per session? Why we need it? Just for Anti-Collision mechanism?Supplejack
As far as I know, it is only 7 byte, So we can have 2^56 contact-less cards with different AIDs, right?Supplejack
@Abraham That's usually a static UID yes, there are also 4 byte random UID's that are. The initial bits specify what kind of UID it is. Note that 2^56 is a lot (16 digits at least), but those bits are not all part of the unique ID. EDIT wrote this down wrong way around, 7 bytes is usually non-random.Electioneer
D
25

"Get Data Command" is defined in PCSC 3 v2. If your driver is PCSC v2 compliant, you can get UID using it:

Class = 0xFF
INS = 0xCA
P1 = 0x00
P2 = 0x00
Le = 0x00 (return full length: ISO14443A single 4 bytes, double 7 bytes, triple 10 bytes, for ISO14443B 4 bytes PUPI, for 15693 8 bytes UID)

Returned value is:

Data+SW1SW2
Diazonium answered 5/11, 2013 at 12:42 Comment(2)
A Linux command to read the UID using opensc: opensc-tool --send-apdu FF:CA:00:00:00 --waitCombes
Thanks @nchokoev! Solved my problem with pcsclite (node adaption)Osullivan
E
6

See the other answer, it is likely that most readers do support the pass through to the card reader by now.


Nobody can help as the UID is specified in the ISO 14443 T=CL transport protocol while APDU's are specified in the ISO 7816 application layer protocol.

So you need access to a lower level API for your contactless reader. PCSC will not suffice (unless there has been a pass through implemented for the specific reader that returns the UID).

Electioneer answered 24/10, 2012 at 15:44 Comment(5)
So, what could be the possible way to read UID of smart card while working with PCSC-Lite?Stigmasterol
I would have a look at the underlying reader libraries. PCSC was initially made for contact readers anyway. Problem is that anything beyond PCSC is likely to be proprietary drivers.Electioneer
Does UID is specific per every contact-less card in world? (i.e. isn't there two different cards with equal UID?) Is it fixed or it is a random number per session? Why we need it? Just for Anti-Collision mechanism?Supplejack
As far as I know, it is only 7 byte, So we can have 2^56 contact-less cards with different AIDs, right?Supplejack
@Abraham That's usually a static UID yes, there are also 4 byte random UID's that are. The initial bits specify what kind of UID it is. Note that 2^56 is a lot (16 digits at least), but those bits are not all part of the unique ID. EDIT wrote this down wrong way around, 7 bytes is usually non-random.Electioneer

© 2022 - 2024 — McMap. All rights reserved.