-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ASN1#to_der in pure ruby #777
base: master
Are you sure you want to change the base?
Conversation
I think the tests outside
What breaking change do you expect? |
09c3fbf
to
e92f837
Compare
@rhenium made a few adjustments to the ruby code. I believe it got cleaner. The same point stands regarding I broke down Didn't start cutting C code just yet. |
e92f837
to
c4823d9
Compare
I think so, unfortunately.
Encoding the value should be trivial. I added in an inline comment.
Please check X.690 for exact details, but encoding these types should be relatively simple too, since they are just encoded into ISO 8601 (except UTCTime uses 2-digit years). |
95e2d8d
to
005d32b
Compare
2f32854
to
1e35012
Compare
@rhenium did UTCTime and GeneralizedTime, lmk what you think. |
13e200e
to
5785230
Compare
lib/openssl/asn1.rb
Outdated
xclass = take_asn1_tag_class(tag_class) | ||
|
||
i = constructed ? V_ASN1_CONSTRUCTED : 0 | ||
i |= (xclass & V_ASN1_PRIVATE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
& V_ASN1_PRIVATE
doesn't change the value, as a tag class can only be one of the 4 classes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ported this from here
d85de19
to
47e6cf5
Compare
47e6cf5
to
cfcbe9e
Compare
@rhenium anything still pending? |
This is a draft request-for-comment proposal for implementing
OpenSSL::ASN1::ASN1Data#to_der
in ruby, as per suggestion on the previous MR. It already passes the test, although there is a part which hasn't been ported yet, and seems not be covered in the tests. I guess that the ruby code can benefit from being broke down in multiple files, but I'll keep it here just for easy of review, ,for now. I also didn't delete C code, not yet.Currently, the whole of
#to_der
is implemented in the ASN1Data class. The reason is, one can build a primitive or constructive object "manually" (if tag and/or tag_class is known), or can just use arrays directly. It would benefit from moving specific implementations into the respective child classes, but then it'd be a breaking change because of what I said. Any suggestions?I also didn't do any benchmarks yet. Is it relevant?
LMK what you think.