The method toBytes in all codecs incorrectly sets the tag class and construction.
In the lines below, I OR'ed the tag octets with the ASN1TagClass and ASN1Construction with the assumption that those enum members had values that were already shifted to the proper bit. Below is the OR in the BER codec:
The method
toBytes
in all codecs incorrectly sets the tag class and construction.In the lines below, I OR'ed the tag octets with the ASN1TagClass and ASN1Construction with the assumption that those enum members had values that were already shifted to the proper bit. Below is the OR in the BER codec:
https://github.com/JonathanWilbur/asn1-ts/blob/5b05c4e4df4169f03ebd0573cb340d2dd205724f/source/codecs/ber.ts#L761-L762
And here it is in the DER codec:
https://github.com/JonathanWilbur/asn1-ts/blob/5b05c4e4df4169f03ebd0573cb340d2dd205724f/source/codecs/der.ts#L720-L721
And here are the enum definitions:
https://github.com/JonathanWilbur/asn1-ts/blob/5b05c4e4df4169f03ebd0573cb340d2dd205724f/source/values.ts#L6-L18
This would result in tags being encoded with the incorrect tag numbers.