On 10/25/2010 11:19 PM, Andre Zepezauer wrote: > Hello, > > anyone with good knowledge of ASN.1 out there? The point is, that in my > opinion the current encoding of TokenInfo.lastUpdate is wrong. It is of > type CHOICE and therefore EXPLICIT tagging has to be used. CHOICE is > always tagged EXPLICIT. Correct?
I am no ASN.1 expert, but the "A Layman's Guide to a Subset of ASN.1, BER and DER" (From RSA 1993) Google for this, as there are a number of sources. 5.5 CHOICE The CHOICE type denotes a union of one or more alternatives. The types must have distinct tags. This requirement is typically satisfied with explicit or implicit tagging on some of the alternatives. An example could be the ECDSA/ECDH parameters (RFC 3279, PKCS#11: EcpkParameters ::= CHOICE { ecParameters ECParameters, namedCurve OBJECT IDENTIFIER, implicitlyCA NULL } From PKCS#11 v2.30" The CKA_EC_PARAMS or CKA_ECDSA_PARAMS attribute value is known as the “EC domain parameters” and is defined in ANSI X9.62 as a choice of three parameter representation methods with the following syntax: Parameters ::= CHOICE { ecParameters ECParameters, namedCurve CURVES.&id({CurveNames}), implicitlyCA NULL } The tags are distinct, so implicit tagging can be used. > > DEFINITIONS IMPLICIT TAGS ::= > > TokenInfo ::= SEQUENCE { > ... > lastUpdate [5] LastUpdate OPTIONAL > ... > } > > LastUpdate ::= CHOICE { > generalizedTime GeneralizedTime > ... > } > > First example is the kind of TokenInfo produced by OpenSC since r2466 > [1]. Second one uses EXPLICIT tagging instead. See offset 2E and > onwards: > > 00000000: 30 3D 02 01 00 04 06 56 71 90 0A 1A 13 0C 0E 4F |0=.....Vq......O| > 00000010: 70 65 6E 53 43 20 50 72 6F 6A 65 63 74 80 0B 4F |penSC Project..O| > 00000020: 70 65 6E 53 43 20 43 61 72 64 03 02 04 10 85 0F |penSC Card......| > 00000030: 32 30 31 30 31 30 31 38 30 30 33 33 30 37 5A |20101018003307Z| > > 00000000 30 3f 02 01 00 04 06 56 71 90 0a 15 13 0c 0e 4f |0?.....Vq......O| > 00000010 70 65 6e 53 43 20 50 72 6f 6a 65 63 74 80 0b 4f |penSC Project..O| > 00000020 70 65 6e 53 43 20 43 61 72 64 03 02 04 10 a5 11 |penSC Card......| > 00000030 18 0f 32 30 31 30 31 30 31 37 30 36 33 36 32 36 |..20101017063626| > 00000040 5a |Z| > > It would be nice, if someone could confirm or reject that issue. > > [1] http://www.opensc-project.org/opensc/changeset/2466/ > > Kind Regards > Andre Zepezauer > > _______________________________________________ > opensc-devel mailing list > opensc-devel@lists.opensc-project.org > http://www.opensc-project.org/mailman/listinfo/opensc-devel > > -- Douglas E. Engert <deeng...@anl.gov> Argonne National Laboratory 9700 South Cass Avenue Argonne, Illinois 60439 (630) 252-5444 _______________________________________________ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel