简体   繁体   English

如何访问使用 MIFARE 应用程序目录结构的 MIFARE Classic 卡?

[英]How to access a MIFARE Classic card that uses the MIFARE Application Directory structure?

How can I make authenticate and read data from a MIFARE Classic card that is formatted with the MIFARE Application Directory structure?如何从使用 MIFARE 应用程序目录结构格式化的 MIFARE Classic 卡进行身份验证和读取数据? I'm using Android.我正在使用安卓。

See NXP's application note on the MIFARE Application Directory .请参阅恩智浦关于MIFARE 应用程序目录的应用说明。 Typically, in order to read data from a MIFARE Classic card that makes use of the MAD, you would do something like the following:通常,为了从使用 MAD 的 MIFARE Classic 卡读取数据,您需要执行以下操作:

  1. Authenticate to sector 0 (MAD sector) using key A A0 A1 A2 A3 A4 A5 (the public MAD read key).使用密钥 A A0 A1 A2 A3 A4 A5 (公共 MAD 读取密钥)对扇区 0(MAD 扇区)进行身份验证。
  2. Read block 3.读取块 3。
  3. Based on the general purpose byte (byte 9 read from block 3), you can determine根据通用字节(从块 3 读取的字节 9),您可以确定
    • if the card uses the MAD (bit 7 = 1),如果卡使用 MAD(位 7 = 1),
    • if the card supports multiple applications (bit 6 = 1), and如果卡支持多个应用程序(位 6 = 1),以及
    • the MAD version (bits 1-0). MAD 版本(位 1-0)。
  4. Read blocks 1 and 2, these blocks have the following format (where AIDx is the application ID assigned to sector number x ):读取块 1 和 2,这些块具有以下格式(其中AIDx是分配给扇区号x的应用程序 ID):

     +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ Byte | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ Block 1 |CRC |INFO| AID01 | AID02 | AID03 | AID04 | AID05 | AID06 | AID07 | +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ Block 2 | AID08 | AID09 | AID10 | AID11 | AID12 | AID13 | AID14 | AID15 | +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
  5. Verify the CRC (block 1, byte 0).验证 CRC(块 1,字节 0)。

  6. Browse through the AID list (as generated from the data of blocks 1 and 2) to find your application AIDs (and consequently to find the sectors that contain your application data).浏览 AID 列表(根据块 1 和 2 的数据生成)以查找您的应用程序 AID(从而找到包含您的应用程序数据的扇区)。
  7. If MAD version 2 is used, authenticate to sector 16 and read blocks 0 (64), 1 (65), and 2 (66) in order to get the extended AID list.如果使用 MAD 版本 2,验证扇区 16 并读取块 0 (64)、1 (65) 和 2 (66) 以获得扩展的 AID 列表。 The format of these blocks is:这些块的格式是:

     +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ Byte | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ Block 0 |CRC |INFO| AID17 | AID18 | AID19 | AID20 | AID21 | AID22 | AID23 | +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ Block 1 | AID24 | AID25 | AID26 | AID27 | AID28 | AID29 | AID30 | AID31 | +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ Block 2 | AID32 | AID33 | AID34 | AID35 | AID36 | AID37 | AID38 | AID39 | +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
  8. Authenticate to the sectors of your application (as discovered through the AID list) and read/write the data of your application.对应用程序的扇区进行身份验证(通过 AID 列表发现)并读取/写入应用程序的数据。

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

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