Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

APDU command to get smart card uid

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

like image 338
Salman Avatar asked Oct 24 '12 14:10

Salman


People also ask

How can I get UID smart card?

"Aadhaar PVC Card" request can be raised by visiting the UIDAI Official Website or Resident Portal (http://www.uidai.gov.in or https://resident.uidai.gov.in) using 12 digits Aadhaar Number (UID) or 16 digits Virtual Identification Number (VID) or 28 digits Enrollment ID.

What are APDU commands?

APDU is a command response protocol for invoking functions executed on a smart card or similar device. In essence, the command consists of a 4 byte header followed by up to 255 bytes of data. The response contains a 2 byte header followed by up to 256 bytes of data.

What is APDU in EMV?

APDU - Application Protocol Data Unit.

What is the meaning of APDU?

In the context of smart cards, an APDU is the communication unit between a smart card reader and a smart card. The structure of the APDU is defined by [ISO 7816-4]. Source(s): NIST SP 800-157 under Application Protocol Data Unit.


2 Answers

"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
like image 121
nchokoev Avatar answered Oct 16 '22 23:10

nchokoev


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).

like image 34
Maarten Bodewes Avatar answered Oct 16 '22 21:10

Maarten Bodewes