Would you mind sending us a sample of an encoded message?

Not at all. :)
Below is a sequence starting off with a tag representing a color space
(as text, so it simply says "CMYK"). This is followed by 4 color
components which are not separately encapsulated in a SEQUENCE OF. In
this case, each color component is a number between 0 and 1 represented
as text.
a2 36
 81 04 43 4d 59 4b
 82 0a 20 20 20 30 2e 37 38 34 33 31
 82 0a 20 20 30 2e 37 32 31 35 36 34
 82 0a 20 20 30 2e 36 39 34 31 31 33
 82 0a 20 20 30 2e 39 39 32 31 35 37

The same thing in XML looks like this:
        <setColor>
           <colorSpace>CMYK</colorSpace>
           <component1>   0.78431</component1>
           <component2>  0.721564</component2>
           <component3>  0.694113</component3>
           <component4>  0.992157</component4>
        </setColor>

In my abstract syntax I use:
SetColor ::= SEQUENCE {
   colorSpace    [1] GeneralString,
   component1    [2] ColorComponent,
   component2    [2] ColorComponent OPTIONAL,
   component3    [2] ColorComponent OPTIONAL,
   component4    [2] ColorComponent OPTIONAL
}
but that gets a bit tedious for some other tags which can have an
arbitrary number of tags. As a stopgap I created another component with
100 OPTIONALs. Not exactly

What Bruno Konik suggested a few days ago, modified slightly to reflect your choice of tag, will work nicely for decoding your sample data.

   Chunk ::= [2] SEQUENCE OF CHOICE {
                head [1] OCTET STRING,
                body [2] BodyChunk
   }
   BodyChunk ::= OCTET STRING

This assumes an IMPLICIT TAG environment, that is, a DEFINITIONS line something like this

   Z DEFINITIONS IMPLICIT TAGS ::= BEGIN

=====================================================================
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