Improving completeness of ASN1 encoding/decoding #335
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To atest some of the improvements of this PR, some encode/decode tests from the ruby-openssl repo were imported (which have been previously commented out).
In broad strokes, the main fixes/improvements from this changeset:
Constructive
and rawASN1Data
objects (the checks around EndOfContent elements were ported from theruby-openssl
repo)Primitive
objects was incorrect, it is now matching what upstream doesruby-openssl
, whichjruby-openssl
could also benefit of, but I don't think it's worth atm to just copy code around, more on that later.isEOC
check to take into account rawASN1Data
objects which "quack" like anEndOfContent
Primitive
objects with an OOTB-unsupported type will now raise an error if the value can't be encoded into a string (same as upstream).I have more detailed information in each commit message, if you prefer that method of review. There were two tests I wasn't able to port, as making them work would require to adapt even more code from BC than I already did here, so I'll leave those for some other time.
On a separate note, it'd be really cool if this could be taken into the finish line. It seems that it's hanging on licensing issues, and I don't know how hard it'd be to coalesce licenses, but besides the usual code copying churn and ability to track what's and what's not supported, I've been trying to lobby for more ruby in the source code (here and here), which would benefit both implementations, but it's hard to do it across multiple repos.
cc @kares @headius