[Asn1] Choice and Enumerated questions

Peter Gutmann pgut001 at cs.auckland.ac.nz
Wed Jan 23 04:48:08 EST 2013


Bruno.Konik <bruno.konik at unigone.com> writes:

>> -----Message d'origine-----
>> 2) the Enumerated can contain also negative numbers.
>> I.e. T ::=3D ENUMERATED {a(-10), b(-20), ..., c(-5), c(-4)} is valid. Is it
>> right?
>
>Yes it can contain negative numbers but...

There's a second but: Historically many encoders have gotten the signedness of
integers wrong, which means that (a) if you get a negative number (at least in
the area of crypto, which I'm most familiar with) it's always an encoding
error and never a deliberate use of a negative value, and (b) because of the
widespread use of incorrect encoders, many decoders treat all integer values
as unsigned.  So while you can use negative values in theory, it's not a good
idea in practice.

Peter.


More information about the Asn1 mailing list