On Tue, 2007-03-06 at 15:01 -0500, Conrad Sigona wrote:
> > I would like to make sure if my understanding of BIT STRING encoding is
> > correct.
> >
> > Let's assume in the following expamle that only ellipsoid point is
> > supported, i.e. bit 0 is set to 1.
> >
> > supportedGADShapes [6] IMPLICIT BIT STRING {
> > ellipsoidPoint (0 ),
> > ellipsoidPointWithUncertaintyCircle (1 ),
> > ellipsoidPointWithUncertaintyEllipse (2 ),
> > polygon (3 ),
> > ellipsoidPointWithAltitude (4 ),
> > ellipsoidPointWithAltitudeAndUncertaintyElipsoid (5 ),
> > ellipsoidArc (6 )} ( SIZE( 7 .. 16 ) ) OPTIONAL}
> >
> > In my opinion this encodes (BER) into:
> >
> > 03 02 01 (= 1 unused bit) 80
> >
> > I would very much appreciate if anybody could confirm this.
>
> It depends upon how precise you would like it to be. BER is less exacting
> about the encoding of trailing 0s than DER. For BER
>
> 03 02 01 80 means '1000000'B
> 03 02 07 80 means '1'B
>
> In both cases the first bit is set; the difference, as you can see, is
> whether we bother encoding the remaining bits. If this were DER, trailing
> zeroes are removed from named bit BIT STRINGs, so the only possible
> encoding would be 03020780; in BER, both are acceptable. Actually, for BER
> even 03020280, 03020380, 03020480, 03020580, and 03020680 would be
> acceptable.
I guess, due to the size constraint, the value must have at least 7
bits. The smallest valid encoding is therefore 03 02 01 80.
Unfortunately, the standard is not very clear about this so I am not
sure. For a non-normative example see X.680 (07/2002), E.2.5.4 where a
value of a BIT STRING defined with a NamedBitList is rejected because it
is too short for the size constraint.
_______________________________________________
Asn1 mailing list
[email protected]
http://lists.asn1.org/mailman/listinfo/asn1