2

I m writing into SCOSTA (specification owned by Indian government) smart card by using APDU commands. I am able to create MF (Master File) and DF (Dedicated File) but when I am creating EF (Elementary file) I am getting an 6A80 - wrong data / Incorrect values in command data. The command which I am using to create the EF is

00 E0 00 00 09 62 07 82 01 00 83 02 4004 00

Could somebody please provide me the correct command to create the EF?

vlp
  • 7,811
  • 2
  • 23
  • 51
user2823104
  • 23
  • 1
  • 3

2 Answers2

2

What takumar means is, that while the structure of the create file command is standardized (see 7816 part 9, contained FCI data objects in part 4), the Data Objects necessary for your card may vary. I personally assume, that a file descriptor (contained in DO 82) of 0 (meaning "no information given") as you specified is unlikely to succeed, try 1 for transparent file instead. Also I recommend specifying a file size (data object 80) and the appropriate access condition for the file (too many choices, so I supply no guess), otherwise even after successful creation you may not be able to write/read later.

guidot
  • 5,095
  • 2
  • 25
  • 37
  • Hi, I used this command with following description. 00 E0 00 00 09 62 07 82 01 00 83 02 40 04 00 00 - CLA E0 - INS 00/00 - P1/P2 09 - Lc 62 - Tag 07 - Length of bytes to follow 82 - File Type tag 01 - No of bytes to follow 00 - EF (I read somewhere that use 38 for DF and 0 for EF) 83 - File Id tag 02 - No of bytes to follow 4004 - Short File ID for EF 00 - Le Please let me know if I made any wrong assumption. – user2823104 Sep 30 '13 at 05:52
  • I don't understand your two trailing zeroes, in the question it was only one, which I assumed to be LE. Take a look at [Scosta](http://www.scosta.gov.in/SCOSTA_1.pdf) specification. File type byte is not defined there, but as I said 0 seems an uninformative choice. File size (now known to be in tag 80) is a *must* for EFs, however. A short EF identifier can't be simply glued on but must be wrapped in a DO with tag 88 (which also needs adjustment of tag 62's length. Zero is no valid value, however, if you don't need a short EF identifier, specify a DO 88 with length zero. – guidot Sep 30 '13 at 07:17
  • Thanks a lot..I am getting what r u trying to say here..I will do accordingly..I have one more doubt along with this EF creation, I want to write data also. So how to add it?In the same command can i add it or i need to use some other APDU command. For Ex. my data is Tag:C0, length:05, value:ASTHA... This data will be C0 05 ASTHA or i need to convert value part into hex?? – user2823104 Sep 30 '13 at 09:38
  • Writing data is definitely a separate command, UPDATE BINARY or APPEND RECORD depending on the chosen file type. The interface sees only bytes, so some instance has to do the conversion. of your text. – guidot Sep 30 '13 at 10:11
0

The is no Iso standard command for file creation. You need to refer to your card's documentation. Most likely, though, you don't have the required priviledges and should start by verifying an ADM code.

Toluene
  • 751
  • 3
  • 9
  • Hi, I using a blank scosta card and trying to create the file structure from scratch. For this I referred the DL card structure and used the same file identifier for MF and DF.In same way i tried to create the EF node which I was unable to create. – user2823104 Sep 30 '13 at 05:49
  • I consider this as wrong, ISO 7816 part 9 defines a *Create* command already in the 2004 edition, even if it was called *Create File* back then (instruction code stayed the same, however). – guidot Dec 10 '18 at 10:27