There is no way of knowing the data size (a.k.a. logical size of a
file) in the ISO 7816 file system.  Inconvenient.  I wish the
standarization group or some smartcard venders put logical size in the
file system meta data.

I think the best way of working this around is to store the logical
size in the first two bytes of the file. 

> I created a file called ABCD with length 500 bytes. I am able to write DER
> encoded DSA keys on it. The size of the keys vary from 490 to 496.
> 
> When calling ReadBinary, how do I know how many bytes of data
> are in a file? Calling GetResponse only gives the size of the file, but
> not how much data was written to it. 
> 
> The bytes that are not written to have value 0xff. For example, if I wrote
> 496 bytes to a 500 byte file, the last 4 bytes of the file have value
> 0xff. I guess I can use 0xff as a terminator much '\0' is used to
> terminate a string in C, but then I wouldnt be able to use 0xff as a data
> value.

***************************************************************
Linux Smart Card Developers - M.U.S.C.L.E.
(Movement for the Use of Smart Cards in a Linux Environment)
http://www.linuxnet.com/smartcard/index.html
***************************************************************

Reply via email to