1

I have got two type of Mifare Classic tags. One have UID of 4 byte and other one have 7 byte. I am trying to read the block of both. I am successful in reading the block of the tag having 4 byte UID but failed to authenticate in case of 7 byte UID. The reader I am using is a ACR122U and reading using ACR122U Tool.

Michael Roland
  • 39,663
  • 10
  • 99
  • 206

1 Answers1

2

Assuming you are using an older version of the ACR122U, you would use the PN532 data exchange command to send an authentication command:

FF 00 0000 0F D440 <TAG_ID> <AUTH_TYPE> <BLOCK> <KEY> <UID>

<TAG_ID> is the index of the tag on the reader (typically 0x01). <AUTH_TYPE> is 0x60 if you want to authenticate with key A and 0x61 if you want to authenticate with key B. <BLOCK> is the block to authenticate for. <KEY> is the 6-byte key (e.g. FF FF FF FF FF FF for the default key). <UID> is the 4-byte UID (or the last 4 bytes of a 7-byte UID).

So if you want to authenticate using key A A0 A1 A2 A3 A4 A5 for block 0 on a tag with the UID 04 AA BB CC DD EE FF, you would use the following command:

FF 00 0000 0F D440 01 60 00 A0A1A2A3A4A5 CCDDEEFF

On newer versions of the reader, you would instead use the standardized mechanism for contactless memory cards defined by PC/SC:

  • Load authentication keys:

    FF 82 0000 06 <KEY>
    
  • Authenticate:

    FF 86 0000 05 0100 <BLOCK> <AUTH_TYPE> 00
    
Michael Roland
  • 39,663
  • 10
  • 99
  • 206
  • Hi! Could you please expand on the exact meaning of "older" and "newer" versions? eg: firmware version or hardware revision. – Free Consulting Feb 18 '15 at 13:06
  • Do you have any info on F/W version numbers? I'm asking because my reader reports relatively newer ver `ACR122U213` but yet fails to authenticate 7 byte UID card with 82 & 86 instructions. Thanks. – Free Consulting Feb 20 '15 at 12:11
  • 1
    Old is at least version 101 to 103( or was it 102?). My guess was that "old" is everything that is 1xx and that "new" is everything that is 2xx (like yours) but I currently only have a 101 and a 102 of which I know that they only support the direct PN532 commands. – Michael Roland Feb 20 '15 at 15:31
  • Did you try if it works if you use the PN532 direct command for authentication? Maybe ACS did not properly truncate the UID to 4 bytes in their implementation of the PC/SC authenticate command... – Michael Roland Feb 20 '15 at 15:33