As written in #8, currently a unsigned value of 33000 will be encoded as 0x80e8. As Counter32 (and other unsigned types) are treated as regular Integers in X.690 (and most implementations), they will assume a two's complement and decode -32536, resulting in utterly behavior.
This pull request resolves this by prepending a zero-byte if the first bit of the unsigned integer is a 1 and therefore could be seen as two's complement.
As written in #8, currently a unsigned value of
33000
will be encoded as0x80e8
. As Counter32 (and other unsigned types) are treated as regular Integers in X.690 (and most implementations), they will assume a two's complement and decode-32536
, resulting in utterly behavior. This pull request resolves this by prepending a zero-byte if the first bit of the unsigned integer is a1
and therefore could be seen as two's complement.