将密钥加载到阅读器的易失性存储器时出错

时间:2013-09-16 14:17:12

标签: smartcard rfid mifare

我正在尝试将FFFFFFFFFFFF密钥加载到omnikey 5321 reader的 volatile 内存中。 但是我收到错误SW1 SW2: 69 86。谁有人建议为什么? (也许omnikey不支持编写易失性密钥?)。

以下是代码:

bcla = 0xFF;
bins = 0x82;
bp1 =0x0     // Load key in volatile memory
bp2 = 0x20  // store in the volatile memory
len = 0x6;       // Length = 6 bytes
sendBuffer[0] = bcla;
sendBuffer[1] = bins;
sendBuffer[2] = bp1;
sendBuffer[3] = bp2;
sendBuffer[4] = len;

// Now, copy the actual key to the send buffer
for (int k =0 ;k<=5;k++)
         sendBuffer[k + 5] = str3[k]; // This will copy FFFFFFFFFFFF key


// then make call to scardtransmit.. also set length of send buffer to 11

1 个答案:

答案 0 :(得分:1)

69 86表示"Command not Allowed"

试试这个......

CLA = FF

INS = 82

P1 = 00

P2 = 60/61(密钥ID,密钥A为60,密钥B为61)

Lc = 06(数据字段中的密钥长度)

数据字段=密钥的值,以6个字节为单位

示例:

  

FF 82 00 60 06 FFFFFFFFFFFF