Hi Andreas, thanks a ton. That explains it very well and answers all my questions.
On Friday, 8. June 2012, Andreas Schwier (ML) wrote: > Hi Peter, > > ERASE and WRITE are left-overs from the old smart card days. Most - if > not all - cards and applications today only implement UPDATE BINARY. > > There is also no common understanding that UPDATE BINARY must not extend > the length of an EF. Some implementations maintain a maximum EF and a > current EF size. The maximum size is typically set in CREATE FILE, > whereas the current EF size depends on the amount of data written to the > EF. An EF may start with no data contained and and UPDATE BINARY command > with P1|P2 = Length of EF (or zero based offset after last byte ;-) > appends the amount of data provided in the C-Data of the APDU. Usually > gaps are not allowed, so an offset beyond end-of-file + 1 gives > SW1/SW2=6B00. > > Other implementations allocate the full EF size at creation, so you can > immediately read from the EF, even though no data has been written yet. > > Hope this helps, > > Andreas > > Am 07.06.2012 22:01, schrieb Peter Marschall: > > Hi, > > > > thanks for the quick reply/correction. > > > > On Thursday, 7. June 2012, Martin Paljak wrote: > >> On Thu, Jun 7, 2012 at 10:35 PM, Martin Paljak <mar...@martinpaljak.net> > > > > wrote: > >>> Hello, > >>> > >>> On Thu, Jun 7, 2012 at 10:24 PM, Peter Marschall <pe...@adpm.de> wrote: > >>>> Here they are: > >>>> * What's the exact difference between WRITE BINARY & UPDATE BINARY? > >>>> > >>>> My understanding of the spec is that WRITE BINARY can extend a file's > >>>> > >>>> size, while UPDATE BINARY can only update data elements that are > >>>> already within the file (i.e. in the range [0 .. file_size-1]). > >>>> > >>>> Is my understanding correct or did I misunderstand the > >>>> specscompletely? > >>> > >>> AFAIU either can change file size (which can be done though 7816-9). > >> > >> Correction, can NOT change file size. > > > > Does that mean that none of them can change the number of data elements > > that are in the file ? > > > > This seems to contradict the sentence in ISO 7816-4 7.2.4 WRITE BINARY > > which states: > > "- the write-once of the bits given in the command data field (the > > command shall be aborted if thestring of data units is not in the > > logical erased state)" > > > > To me that sentence sounds like WRITE BINARY is an operation that > > A) can only be used on data that is logically reset, > > > > (i.e. once WRITE_BINARY was performed, it cannot be used on the same > > data any more without a preceding ERASE BINARY of that region) > > > > B) can extend the number of data units in the file > > > > (this is what I sloppily called existing_file_size in my< previous > > mail) > > > > In the other hand, ISO 7816-4 7.2.4 UPDATE BINARY says: > > "the command initialtes the update of the bits already present in an EF > > ..." > > > > This is what I interpret as "can only update existing data units in the > > file, but not create more. > > > > Am I completely wrong? > > Are there "interpretation helpers" for the spec available somewhere? > > > > > > While I am at it: > > Would you mind to pull Pull Request #53 > > > > https://github.com/OpenSC/OpenSC/pull/53 > > > > into the staging branch of github's open/opensc? > > (It is a little bit frustrating to not get any feedback at all for a > > PullReq ;-) > > > > Thanks > > PEter -- Peter Marschall pe...@adpm.de _______________________________________________ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel