Subject: RE: ASN.1 , Constructed Encoding

From: [email-masked]
Date: Tue, 4 Apr 2000 09:21:46 -0400

Daren Hunter wrote:

>Given this, the IA5String that we are discussing is slightly
>strange as the three encodings that contain the 'test1', '@',
>and 'rsa.com' parts collectively form the 'DATA' part of the
>encoding for a single IA5String - I think we're probably in
>agreement up to this point.  These parts should fall under
>the specific rules for encoding the value of IA5Strings.  If the
>IA5String rules state that the component parts should be encoded
>as OCTET STRINGs, then you are right and 04 tags should be used
>for the component parts.  However, if the rules for IA5String
>say that the component parts should be encoded as IA5Strings
>(using the above definition), then IMHO you are wrong, and 16
> tags should be used.

X680 (or rather ISO/IEC 8825-1) says:

"Each character string type shall be encoded as if it had been declared
[UNIVERSAL x] IMPLICIT OCTET STRING"

This means that encoding a character string is a two-part process:

1) take the sequence of octets that makes up the character
string value and encode it as an OCTET STRING.

3) replace the tag of the OCTET STRING encoding with the tag for
"UNIVERSAL x".

The section that defines character string encoding doesn't mention
segmenting the string into substrings using constructed encoding -
that option comes from the OCTET STRING encoding in step 1, so it
must follow the rules for segmenting OCTET STRINGS, which says
explicitly when referring to segmented encodings that "In particular,
the tags in the contents octets are always universal class, number 4".

One interesting "feature" of this is that, since the segmentation
happens at the OCTET STRING level, the segment breaks may occur in the
middle of a character code if the codeset is a multi-byte one.

John

---

From: "Darren Harter" <[email-masked]>
Date: Tue, 4 Apr 2000 14:49:53 +0100

John,

Thanks for this.  I'm sure they'll be a few on the list, thinking "I didn't
know OCTET STRINGs could do that!"  Segmenting of OCTET STRINGs is certainly
a feature I wasn't aware of - it's good to know that even after 10 years of
ASN.1 the language can still turn around and bite me on the butt.

Kind regards,

Darren

-----Original Message-----
From: [email-masked] [mailto:[email-masked]]
Sent: 04 April 2000 14:22
To: Darren Harter
Cc: 'Hans Schupp'; [email-masked]; [email-masked]
Subject: RE: ASN.1 , Constructed Encoding

John