-1

I am working with SCOSTA Smart card, I have successfully created MF,DF,EF file structure,I have successfully created EF file formate in smart card and following is the code.

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`

I have write binary command in smart card using APDU 00 D0 00 04 10+Data.so with the help of this, I have successfully written data in the smart card, before reading binary command ,I have selected the written file on the smart card, after that I have used the READ Binary APDU command 00 B0 00 00 00.the response status is:

6986 Command not allowed (no current EF).

Read Binary Code:

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);

I have 2 following external tools for reference:

  1. Smart Card ToolSet PRO v3.4
  2. Cryptware Smart Card Console

By making use of these tools I can write binary, Update binary, Read binary, Get data, so I have successfully executed these operation with the help of above tools and the response is "9000" but in my own Coded Smart card Application is not working properly, i.e. Write Binary, Update Binary, Read Binary command. What is the sequence of performing operation on smart card from start to end steps?

vlp
  • 7,811
  • 2
  • 23
  • 51
  • Have you tried reselecting the file after writing the data to it? Also what was the status words from the write binary? – Dean Aug 12 '15 at 13:08

1 Answers1

0

8c tag is about Compact security. Hope this error because of security enabled during creation of file.

could you share APDU commands in readable form? it will help to identify the problem.

Arjun
  • 3,491
  • 4
  • 25
  • 47