如何从使用MIFARE应用程序目录结构格式化的MIFARE Classic卡进行身份验证和读取数据?我正在使用Android。
答案 0 :(得分:8)
请参阅恩智浦关于MIFARE Application Directory的应用说明。通常,为了从使用MAD的MIFARE Classic卡读取数据,您可以执行以下操作:
A0 A1 A2 A3 A4 A5
(公共MAD读取密钥)对扇区0(MAD扇区)进行身份验证。读取块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 |
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
验证CRC(块1,字节0)。
如果使用MAD版本2,则对扇区16进行认证并读取块0(64),1(65)和2(66)以获得扩展的AID列表。这些块的格式是:
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
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 |
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
对应用程序的各个部分进行身份验证(通过AID列表发现)并读取/写入应用程序的数据。