-1

我正在使用 SCOSTA 智能卡,我已成功创建 MF、DF、EF 文件结构,我已成功在智能卡中创建 EF 文件格式,以下是代码。

SendBuff[0] = 0x00;     //CLA
SendBuff[1] = 0xE0;     //INS
SendBuff[2] = 0x00;     //p1
SendBuff[3] = 0x00;     //p2
SendBuff[4] = 0x1A;     //len
SendBuff[5] = 0x62;     //T
SendBuff[6] = 0x18;     //L

SendBuff[7] = 0x80;     //T
SendBuff[8] = 0x02;     //Len
SendBuff[9] = 0x02;     //Value,File size
SendBuff[10] = 0x08;    //value,File size

SendBuff[11] = 0x82;    //T
SendBuff[12] = 0x01;    //Len
SendBuff[13] = 0x01;    //FDB (Transparent Working EF)

SendBuff[14] = 0x83;     //T
SendBuff[15] = 0x02;     //Len
SendBuff[16] = 0xE0;     //EF INDENTIFIER
SendBuff[17] = 0x07;

SendBuff[18] = 0x88;      //T
SendBuff[19] = 0x01;      //Len
SendBuff[20] = 0x09;      //Value

SendBuff[21] = 0x8A;      //T
SendBuff[22] = 0x01;
SendBuff[23] = 0x01;      //LCSI. When file is created first, it will be in 01

SendBuff[24] = 0x8C;      //T
SendBuff[25] = 0x05;      //Len
SendBuff[26] = 0x6A;      //Security Attributes
SendBuff[27] = 0xFF;        //Delete File: Never
SendBuff[28] = 0xFF;        //Terminate EF: Never
SendBuff[29] = 0xFF;        //Deactivate EF: Never
SendBuff[30] = 0x23;        //Update Binary: SE#3`

我已经使用 APDU 00 D0 00 04 10+Data 在智能卡中写入二进制命令。所以在这个帮助下,我已经成功将数据写入智能卡,在读取二进制命令之前,我选择了智能卡上写入的文件,之后我使用了READ Binary APDU命令00 B0 00 00 00。响应状态为:

6986 命令不允许(无当前 EF)。

读取二进制代码:

ModWinsCard.SCARD_IO_REQUEST SendRequest;
SendRequest.dwProtocol = 1;
SendRequest.cbPciLength = 8;

ModWinsCard.SCARD_IO_REQUEST RecvRequest;
RecvRequest.dwProtocol = 1;
RecvRequest.cbPciLength = 8;


byte[] SendBuff = new byte[255];
byte[] RecvBuff = new byte[255];

int SendBuffLen = 0x5;
int RecvBuffLen = 0x12;

//Byte currentBlock = (byte)(int.Parse(strBlock));
//Byte currentBlock = Convert.ToByte(strBlock, 16);
//Byte len = Convert.ToByte(Len);

SendBuff[0] = 0x00;
SendBuff[1] = 0xB0;       
SendBuff[2] = 0x00;
SendBuff[3] = 0x00;
SendBuff[4] = 0x00;

status = ModWinsCard.SCardTransmit(hCard, ref SendRequest, ref SendBuff[0], SendBuffLen, ref RecvRequest, ref RecvBuff[0], ref RecvBuffLen);

我有 2 个以下外部工具可供参考:

  1. 智能卡工具集 PRO v3.4
  2. Cryptware 智能卡控制台

通过使用这些工具,我可以编写二进制文件、更新二进制文件、读取二进制文件、获取数据,所以我在上述工具的帮助下成功执行了这些操作,响应为“9000”,但在我自己的编码智能卡应用程序中却没有正常工作,即写入二进制、更新二进制、读取二进制命令。从开始到结束步骤对智能卡执行操作的顺序是什么?

4

1 回答 1

0

8c 标签是关于 Compact 安全性的。希望这个错误是因为在创建文件期间启用了安全性。

你能以可读的形式分享 APDU 命令吗?这将有助于确定问题。

于 2015-08-12T10:42:31.963 回答