Re: [opensc-devel] questions on {ERASE, WRITE, UPDATE} BINARY commands

2012-06-08 Thread Andreas Schwier (ML)
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  
> wrote:
>>> Hello,
>>>
>>> On Thu, Jun 7, 2012 at 10:24 PM, Peter Marschall  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
>


-- 

-CardContact Software & System Consulting
   |.##> <##.|   Andreas Schwier
   |#   #|   Schülerweg 38
   |#   #|   32429 Minden, Germany
   |'##> <##'|   Phone +49 171 8334920
-http://www.cardcontact.de
 http://www.tscons.de
 http://www.openscdp.org


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


[opensc-devel] is this card? is it supported?

2012-06-08 Thread helpcrypto helpcrypto
Hi!

Our company -finally-, is going to change the smartcard we are using.
Actually we have a non-cryptographic, and seems we are sitching to "3B
6F 00 00 80 66 B0 07 01 01 77 07 53 02 31 24 82 90 00"

Looking at 
http://ludovic.rousseau.free.fr/softwares/pcsc-tools/smartcard_list.txt
i have found its ccid supported (already know that), but the names
doesnt seem to be correct.
This card is an "Optelio Card Santander"/R5/other alias, in other
words, a card which a bank here at Spain (banco santander) gives to
Universities like Huelva, Pompeu Fabra, etc (and many many others).
There are some models provided by gemalto, maybe others by FNMT.

How should i update the list or add the info about that card?
Does anyone have some commands he/she would like me to send? (is this
really properly written?)

Another thing i will like to know if it is supported by opensc. There
are a bunch of universities out there that seem to have it, but
usually through gemalto gclib pkcs#11

I have checked
http://www.opensc-project.org/opensc/tags?q=%27supported%27
and
http://www.opensc-project.org/opensc/wiki/SupportedHardware
and didnt find the spanish DNIe (which actually is working based on
opensc), so i dont know about this.

Im going to invoke "opensc-tool --name" in a moment, but maybe there
are more test i should do.
Are they documented somewhere?

EXTRA for Ludovic Rousseau:
in http://ludovic.rousseau.free.fr/ you have some encoding troubles.

"système d'exploitation préféré" where it should be something like
"système...préféré", isnt it?
"Ma clé GnuPG" where it should be "clé", right?

jai oublié tout le français que j'etudié dans l'ecole ;)
___
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Re: [opensc-devel] questions on {ERASE, WRITE, UPDATE} BINARY commands

2012-06-08 Thread Peter Marschall
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 
> > 
> > wrote:
> >>> Hello,
> >>> 
> >>> On Thu, Jun 7, 2012 at 10:24 PM, Peter Marschall  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


Re: [opensc-devel] is this card? is it supported?

2012-06-08 Thread Ludovic Rousseau
2012/6/8 helpcrypto helpcrypto :
> Hi!

Hello,

> Our company -finally-, is going to change the smartcard we are using.
> Actually we have a non-cryptographic, and seems we are sitching to "3B
> 6F 00 00 80 66 B0 07 01 01 77 07 53 02 31 24 82 90 00"
>
> Looking at 
> http://ludovic.rousseau.free.fr/softwares/pcsc-tools/smartcard_list.txt
> i have found its ccid supported (already know that),

The card is not "ccid supported". It is a card, not a ccid reader.
My list is just an association between an ATR and a name. Nothing more.

I don't know if this card is supported by OpenSC.

> EXTRA for Ludovic Rousseau:
> in http://ludovic.rousseau.free.fr/ you have some encoding troubles.
>
> "système d'exploitation préféré" where it should be something like
> "système...préféré", isnt it?
> "Ma clé GnuPG" where it should be "clé", right?

Configure your browser to use the automatic encoding or use UTF-8.

> jai oublié tout le français que j'etudié dans l'ecole ;)

J'ai oublié tout le français que j'ai étudié à l'école.

No bad :-)

-- 
 Dr. Ludovic Rousseau
___
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel