Description
ReadOptionalASN1Boolean
doesn't work like the other ReadOptionalASN1*
methods, nor does it work in the way it seems to be intended.
ReadOptionalASN1Boolean
seems to expect to support reading a example BOOLEAN OPTIONAL
field that does not use context-specific tags, unlike the other ReadOptionalASN1*
methods, but will in fact only work when reading a structure containing two subsequent BOOLEAN fields, i.e.
example-a BOOLEAN OPTIONAL
example-b BOOLEAN
as it continues reading from the source cryptobyte.String
, rather than the optional field.
There are two possible solutions for this. (1) fix the method to support optional fields without context-specific tags (which are rather rare), or (2) fix the method to support optional fields with context-specific tags (which matches the other ReadOptionalASN1*
methods). I think (2) makes the most sense since it aligns with the other methods in the package and is more likely to be used in the real world, but it does require breaking the existing API by adding an argument for the expected context-specific tag.
As far as I can tell there are no uses of this method in the standard library, and after a quick search of GitHub I was unable to find any third-party packages using this (if any are, they are likely quite broken since this method should never really work).