Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version)?
go version go1.10.3 darwin/amd64
Does this issue reproduce with the latest release?
yes
What did you do?
I tried to decode a boolean asn.1 value using the cryptobyte package.
Boolean "True" value encoded using the stdlib asn.1 encoder is 0x0101FF tag 0x01 - boolean value
length 0x01 - 1 byte and the value 0xff - 0x00 is false, everything else if true.
When decoding the value using the cryptobyte package I have encountered some issues.
-
Using ReadASN1Boolean - it expects tag 0x02 - Integer instead of tag 0x01 - Boolean, so it returns false when reading 0x0101FF value
-
Using ReadOptionalASN1Boolean - it correctly expects 0x01 tag, and reads the value into a child cryptobyte string (that would contain x0FF bytes in my case), then in case the value exists, proceeds to read the remainder of the input which is not correct, it should examine the value read into the child cryptobyte string and return without advancing further.
Both bugs are trivial to fix and I am happy to submit a patch.
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version)?go version go1.10.3 darwin/amd64
Does this issue reproduce with the latest release?
yes
What did you do?
I tried to decode a boolean asn.1 value using the cryptobyte package.
Boolean "True" value encoded using the stdlib asn.1 encoder is
0x0101FFtag 0x01 - boolean valuelength 0x01 - 1 byte and the value 0xff - 0x00 is false, everything else if true.
When decoding the value using the cryptobyte package I have encountered some issues.
Using
ReadASN1Boolean- it expects tag 0x02 - Integer instead of tag 0x01 - Boolean, so it returns false when reading 0x0101FF valueUsing
ReadOptionalASN1Boolean- it correctly expects 0x01 tag, and reads the value into a child cryptobyte string (that would contain x0FF bytes in my case), then in case the value exists, proceeds to read the remainder of the input which is not correct, it should examine the value read into the child cryptobyte string and return without advancing further.Both bugs are trivial to fix and I am happy to submit a patch.