El jue, 21-04-2011 a las 10:03 +0200, NdK escribió:
> > The problem I have is to read a file with an unknown length.
> How is that possible? Aren't file sizes fixed at file creation time?
> Have I missed something?
> IIUC, when you issue a SELECT_FILE, you can see its size, too. I'm confused.

Sure: any card that uses compressed file (as spanish DNIe does)
In our case, FCI file size is useless: I had to implement a sort
of file cache, that:
- fill cache with consecutive read_binary(max_apdu_recv) +
realloc(), until I receive SC_ERROR_WRONG_LENGTH
- Then make a last read_binary with proper lenght
- check if data is compressed, uncompress if needed
- update properly sc_file lenght fields

By mean of this artifact, I get read_binary handle compressed files
in a transparent way... but I had to implement my own read_binary, 
to meet these requeriments instead of calling iso_read_binary(),
as with current implementation is useless for me, even for filling
cache

http://forja.cenatic.es/plugins/scmsvn/viewcvs.php/opensc-opendnie/trunk/src/libopensc/card-dnie.c?root=opendnie&view=log

Juan antonio

_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to