说我想要认证米法瑞经典。
我怎么知道要发送到卡片上的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经典的示例程序。我的问题基本上是,我怎么知道怎样发送什么样的APDU到卡?我如何知道在sendBuffer中应该是什么
发布于 2013-09-16 11:47:27
阅读此文章.Here,您将发现APDU结构与Mifare卡通信.
发布于 2015-01-31 19:45:11
在Mifare经典1K标记中,有16个扇区,每个扇区包含4个块,每个扇区包含16个字节。
在读取或写入块之前,您必须使用该扇区的键A或键B验证其相应的扇区。当身份验证完成后,您就可以读写了。使用此命令,您可以使用键A(60)验证扇区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 };当身份验证成功时,您将得到9000。这就是成功的信息。否则响应为63 00,这意味着身份验证失败。当身份验证完成后,您可以读取块(0、1、2、3),因为扇区0包含4个块,而这些块是块(0、1、2、3)。
有关更多细节,您可以阅读这个答案。抱歉英语不太好
https://stackoverflow.com/questions/18824879
复制相似问题