简体   繁体   English

使用ACR122U NFC读卡器的Mifare 1K NFC标签的身份验证失败

[英]Authentication failure for Mifare 1K NFC tag using ACR122U NFC reader

I always get the failure result when using ACR122U tool to authenticate Mifare 1K NFC tag, but I can use Android phone to read/write this tag. 当使用ACR122U工具验证Mifare 1K NFC标签时,我总是得到失败的结果,但我可以使用Android手机来读/写这个标签。

ACR122U Load Authentication Keys
< FF 82 00 00 06 FF FF FF FF FF FF 
> 90 00 
< Key Structure: 00    < Key Number: 00
< Key: FF FF FF FF FF FF
Load Authentication Keys Success

ACR122U Authentication
< FF 86 00 00 05 01 00 00 60 00 
> 63 00 
Operation failed

Your remark about an Android phone being able to read and write this tag suggests it is formatted to contain NDEF data. 您对Android手机能够读取和写入此标签的评论表明其格式化为包含NDEF数据。 Instead of the factory default key 0xFFFFFFFFFFFF, you could try to use the MIFARE Application Directory key 0xA0A1A2A3A4A5 for the first sector (blocks 0-3) and the NFC Forum key 0xD3F7D3F7D3F7 for the following sectors. 您可以尝试将MIFARE应用程序目录密钥0xA0A1A2A3A4A5用于第一个扇区(块0-3),并将NFC论坛密钥0xD3F7D3F7D3F7用于以下扇区,而不是出厂默认密钥0xFFFFFFFFFFFF。 See NFC Type MIFARE Classic Tag Operation for more details. 有关详细信息,请参阅NFC类型MIFARE经典标签操作

The authentication of a MF Classic 1k card can be failed with different reasons. MF Classic 1k卡的验证可能因不同原因而失败。

  1. Wrong Key 错误的钥匙

    a. 一个。 Length : It should be 6 bytes (12 Hex chars). 长度:应为6个字节(12个十六进制字符)。

    b. Key Matching : The key will be the hex FFFFFFFFFFFF in transport mode (by default) and it can be changed by a card providing vendor. 密钥匹配:密钥将是传输模式中的十六进制FFFFFFFFFFFF(默认情况下),并且可以由提供供应商的卡更改。 You have to get the exact key from the vendor. 您必须从供应商那里获得确切的密钥。

  2. Key Category : The access condition (6-9 bytes of Block 3 of all sectors) will explain which key you have to use to authenticate a corresponding sector for a particular memory operation .To know more details please refer 密钥类别:访问条件(所有扇区的块3的6-9个字节)将说明您必须使用哪个密钥来验证特定存储器操作的相应扇区。要了解更多详细信息,请参阅

http://www.nxp.com/documents/data_sheet/MF1S50YYX.pdf http://www.nxp.com/documents/data_sheet/MF1S50YYX.pdf

In Mifare Classic 1K tags There are 16 Sectors and each Sectors contains 4 Blocks and each block contains 16 bytes. 在Mifare Classic 1K标签中有16个扇区,每个扇区包含4个块,每个块包含16个字节。 Before Reading or writing from a page You must have to Authenticate The Sector using Key A or Key B. When Authentication is complete then you can read or write. 在从页面读取或写入之前您必须使用密钥A或密钥B对扇区进行身份验证。当身份验证完成后,您可以进行读取或写入。 Here is the Authentication Command Authenticate sector 0 using that key as key A (60): 以下是使用该密钥作为密钥A(60)的认证命令认证扇区0:

FF 86 0000 05 01 0000 60 00

Or authenticate sector 0 using that key as key B(61): 或者使用该密钥作为密钥B来验证扇区0(61):

FF 86 0000 05 01 0000 61 00

or using this command you can also authenticate sector 0 或者使用此命令,您还可以验证扇区0

byte[] authenticationByte = new byte[10];
    authenticationByte = new byte[] { (byte) 0xFF, (byte) 0x86, (byte) 0x00,
 (byte) 0x00, (byte) 0x05, (byte) 0x00,(byte) 0x00, (byte) 0x04, 
                                    (byte) 0x60,(byte) 0x00 };

for more details you can follow this answer 有关详细信息,您可以按照此答案

Use "NFC TagInfo" application for android. 使用“NFC TagInfo”应用程序用于Android。 You can read hex data with that app and find out your correct keys. 您可以使用该应用程序读取十六进制数据并找出正确的密钥。 In the end of every sectors there will be "keya, access, keyb" data. 在每个扇区的末尾都会有“keya,access,keyb”数据。 First 6 byte (12 hex character) is key a and last 6 byte (12 hex character again) is key b. 前6个字节(12个十六进制字符)是密钥a,后6个字节(再次是12个十六进制字符)是密钥b。 Use new keys for reading and writing to card. 使用新密钥读取和写入卡。

I have written an utility for some ACR readers and the ACR 122U with Mifare classic cards is hitting some kind of bug. 我为一些ACR读者编写了一个实用程序 ,带有Mifare经典卡的ACR 122U正在遇到某种错误。 The identical code works for ACR 1222L. 相同的代码适用于ACR 1222L。

However Mifare Classic cards are crap, so I suggest switching cards to work around the problem. 然而,Mifare Classic卡是废话,所以我建议切换卡来解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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