简体   繁体   中英

Mifare Classic 1k APDU command for retrieving tag UID

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM