【发布时间】:2013-09-16 09:42:33
【问题描述】:
假设我想向 Mifare Classic 进行身份验证。
我如何知道要发送到卡的确切 APDU 类型?
示例。
这段代码:
bcla = 0xFF;
bins = 0x86;
bp1 = 0x0;
bp2 = 0x0; // currentBlock
len = 0x5;
sendBuffer[0] = bcla;
sendBuffer[1] = bins;
sendBuffer[2] = bp1;
sendBuffer[3] = bp2;
sendBuffer[4] = len;
sendBuffer[5] = 0x1; // Version
sendBuffer[6] = 0x0; // Address MSB
sendBuffer[7] = currentBlock;
if(keyradioButton->Checked==true) // Address LSB
sendBuffer[8] = 0x60; // Key Type A
else if(keynumberradioButton->Checked ==true)
sendBuffer[8] = 0x61; // Key Type B
sendBuffer[9] = keynumber; // Key Number
sendbufferlen = 0xA;
receivebufferlen = 255;
//Invoke the Transmit command
retval = SCardTransmit(hCard, // A reference value returned from the SCardConnect function.
&sioreq,
sendBuffer, // Send buffer
sendbufferlen, // Send buffer length
&rioreq,
receiveBuffer, // Receive butter
&receivebufferlen); // Length of received buffer
是一个尝试向 Mifare Classic 进行身份验证的示例程序。
我的问题基本上是,我怎么知道要向卡发送什么样的 APDU?例如,我怎么知道sendBuffer 中应该包含什么?
【问题讨论】:
-
很抱歉,但我无法理解这个问题......你能描述一下这个问题吗?
-
@vikky:嘿,vikky,请看编辑
-
MIFARE Classic 本身不使用 APDU。 APDU 的使用是读卡器的扩展:它在内部将 APDU 转换为实际的 MIFARE Classic 命令。为了澄清这个问题,我建议您添加您正在使用的读卡器的品牌和类型
-
@NFCguy:我很惊讶 Classic 不使用 APDU。你能给我介绍一些解释这一点的文档吗?以及您提到的读者将 APDU 转换为经典命令的内容?我想了解更多相关信息。
-
@NFCguy:是的,我看过了。实际上,没有提到我用于身份验证的完整 APDU 命令。文档只是说例如 60h 是 command 用于使用密钥 A 进行身份验证。其他类型的 Mifare 卡也是如此(例如,Plus 等)吗?他们不接受 APDU 的?
标签: authentication smartcard rfid mifare