On Mon, 18 Jun 2001, Benoit POSTE wrote:
> This time I am struggling with the encoding of a SEQUENCE in
> DER. Maybe my only problem is that I began with the complexity of
> PER, and thus feeling a bit lost in the simplicity of DER
> encoding ;).
>
> First, in the case of a two part RootComponentTypeList (with
> an ExtensionAdditions in the middle), do we encode first the
> whole RootComponentTypeList and then the ExtensionAdditions (as
> in PER) or are the ComponentTypes encoded in the lexical order
> (first the first part of the RootComponentTypeList, then the
> ExtensionAdditions, then the second part of the
> RootComponentTypeList)?
No. In DER SEQUENCE is are encoded in textual order, and SET
is encoded in canonical tag order.
> Second problem, consider:
> Digit ::= INTEGER (0..9)
> Toto ::= SEQUENCE
> {
> a CHOICE {
> v [0] Digit,
> w [1] Digit, -- v0
> ...
> } OPTIONAL,
> b CHOICE {
> x [3] Digit,
> y [4] Digit
> } OPTIONAL
> }
>
> Is there anything that prevents the receiver from decoding a
> value
> {b x:4} (hence "a" non-present) as an "a with unknown extension"
> and "b" non-present? As far as I understand it, it would need the
> following definition to be illegal:
> Toto ::= SEQUENCE
> {
> a CHOICE {
> v [0] Digit,
> w [1] Digit,
> ...,
> u [3] Digit -- v1
> } OPTIONAL,
> b CHOICE {
> x [3] Digit,
> y [4] Digit
> } OPTIONAL
> }
> Is it (illegal)? I can't seem to find the paragraph that
> mentions it in X.680 ...
Yes, it is illegal:
OSS Nokalva ASN.1 Compiler Version 5.3
Copyright (C) OSS Nokalva 1989-2001. All rights reserved.
"oo.asn", line 10 (D): A0100E: Duplicate tag in type Toto: element 'a'
(line 4) and element 'b' (line 10).
See X.680 clause 24.5.1 for the clause that Toto violates.
-------------------------------------------------------------------------
Bancroft Scott Toll Free :1-888-OSS-ASN1
OSS Nokalva International:1-732-302-0750
[EMAIL PROTECTED] Tech Support :1-732-302-9669 x-1
1-732-302-9669 x-200 Fax :1-732-302-0023
http://www.oss.com