Lev,

Lev Walkin wrote:
Rick Berge wrote:

Bertil Karlsson wrote:

Hello,

I wonder if someone knows the right BER encoding of the following example:

Seq ::= SEQUENCE{
  a     [PRIVATE 1] IMPLICIT OCTET STRING
}

If the component is encoded with value 1,2,3 (three octets) in
constructed  form what would
the encoding of the inner OCTET STRING be?

Which of the following is right for Seq?
a        48,7,225,5,4,3,1,2,3        [UNIVERSAL 4] as inner tag
b        48,7,225,5,193,3,1,2,3    [PRIVATE 1] as inner tag


Lev Walkin wrote:

Second form is correct.



...but unless I'm missing something, you have an extra tag (225) between
SEQUENCE (48) and [PRIVATE 1] (193).


You are missing something. The constructed [private 1](225) is not
necessary, as there is a primitive [private 1] (193). It is would
be necessary only in case of nested tags, which is not the case.

I think you have missed Note 2 on Clause 8.7.3.2 of X.690 (07/2002):

   "In particular, the tags in the contents octets are always universal class, 
number 4."

The "contents octets" being the contents octets of the constructed (outer) 
OCTET STRING encoding.
This makes the first form (case a) the correct encoding.

Regards,
Steven
_______________________________________________
ASN1 mailing list
[email protected]
http://lists.asn1.org/mailman/listinfo/asn1

Reply via email to