假设我想对 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 中应该包含什么?

最佳答案

阅读这个 Article 。在这里你会找到与 Mifare 卡通信的 APDU 结构......

关于authentication - Mifare 认证,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/18824879/

10-10 13:08