1
votes

As the title says; is there a APDU command for retrieving the UID of a tag? I am using Java, with an ACR122-u cardreader and the javax.smartcardio.* package and I want to get the UID from a tag on the scanner. The smartcardio library can send CommandAPDU's but I need to figure out what APDU to send. Google has not been very friendly to me on this one, providing me with thousands of unhelpful datasheets of some sort...

Any help would be great :)

2
Maybe this can help you! rado already asked something like this and had the answer to this question in his question. I hope it can help you.Unknown222

2 Answers

9
votes

Better late than never but there is actually an APDU to JUST retrieve the UID: (byte) 0xFF, (byte) 0xCA, (byte) 0x00, (byte) 0x00, (byte) 0x00

FF CA 00 00 00

In Java: byte[] getuid = new byte[] { (byte) 0xFF, (byte) 0xCA, (byte) 0x00, (byte) 0x00, (byte) 0x00 };

If you send this APDU, the response data will be just the UID of the card :) (Much easier than having more info and having to set an offset to get just the info you need...)

0
votes

The APDU Command for Read UID is

byte[] baReadUID = new byte[5];

    baReadUID = new byte[] { (byte) 0xFF, (byte) 0xCA, (byte) 0x00,
            (byte) 0x00, (byte) 0x00 };

All Complete code is here....