maybe there is some one having coded S/MIME before,
I have one question about the DER encoding of a protocol element
Coding the eContent in the signed-type the specification is:
EncapsulatedContentInfo SEQUENCE {
eContentType Content Type,
eContent [0] EXPLICIT OCTET STRING OPTIONAL }


The coding for the last element should be A0 82 01 2E - 04 82 01 2A followed by the user data ? I wonder if it is correct because some receiving S/MIME clients do not accept  the tag for octet string X'04' as a tag but interpret it as data.

Sorry, maybe I did not explain the content very well:

A0 82 01 2E  04 82 01 2A + following content with length X'012A',

thus:

A0    [0]
82   (length sign > 127)
01 2E   length of everything following from here

04   octet string
82   (length sign > 127)
01 2A  length of everything following from here

content, with length 012A


the question is if the tag X'04' is needed at all, normally it should,
because the rule is 'EXPLICIT OCTET STRING'

Dear Mr. Byldner:

It is correct as you have it with the double tags, one (A0) for the [0] and the second (04) for the [UNIVERSAL 4] which is the default for an OCTET STRING.

If you find that the receiving side is treating the 04 as data, perhaps it thinks it's IMPLICIT rather than EXPLICIT. Even so, such behavior cannot be readily explained since the A0 tag octet has the constructed bit enabled. Whenever the constructed bit is enabled, the receiver knows that the length is immediately followed by another tag.

Even without benefit of an ASN.1 specification like

    eContent [0] EXPLICIT OCTET STRING OPTIONAL }

that is, if

    A0 82 01 2E  04 82 01 2A ...

were left to the receiver to decode as a puzzle, he would still know that

a) A0 - we have a context-specific ([0]) tag on a constructed element, so we would expect another tag following the length;

b) 82012E - the length of the stuff that follows is 302;

c) 04 - an inner tag, which since it's a universal tag, clearly describes an OCTET STRING field; and

d) 82012A - the length of the OCTET STRING is 298.


=====================================================================
Conrad Sigona                    Voice Mail     : 1-732-302-9669 x400
OSS Nokalva                      Fax            : 1-614-388-4156
[EMAIL PROTECTED]                   My direct line : 1-315-845-1773
_______________________________________________
Asn1 mailing list
[email protected]
http://lists.asn1.org/mailman/listinfo/asn1

Reply via email to