You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In OpenSSL gem 2.0.6 (using Ruby 2.4.2) and as far back as Ruby 2.2.1 (if not earlier), creating OpenSSL::ASN1::Integer instances using OpenSSL::ASN1.decode produces instances whose value attribute is of type OpenSSL::BN, not Number (which should probably be documented as Integer) as documented on the docs page for OpenSSL::ASN1::Primitive (http://ruby-doc.org/stdlib-2.4.2/libdoc/openssl/rdoc/OpenSSL/ASN1/Primitive.html).
Either OpenSSL::ASN1.decode should be modified to return OpenSSL::ASN1::Integer instances whose value attribute is of type Integer, not OpenSSL::BN. If this is not palatable from a backwards compatibility standpoint, this discrepancy should at least be documented.
The text was updated successfully, but these errors were encountered:
CBonnell
changed the title
OpenSSL::ASN1.decode yields OpenSSL::ASN1.Integer instances with a "value" attribute type of OpenSSL:BN
OpenSSL::ASN1.decode yields OpenSSL::ASN1::Integer instances with a "value" attribute type of OpenSSL:BN
Dec 13, 2017
CBonnell
changed the title
OpenSSL::ASN1.decode yields OpenSSL::ASN1::Integer instances with a "value" attribute type of OpenSSL:BN
OpenSSL::ASN1.decode yields OpenSSL::ASN1::Integer instances with a "value" attribute type of OpenSSL::BN
Dec 13, 2017
This behavior goes all the way back to Ruby 1.8.1 in 2003, when OpenSSL::ASN1 was initially introduced. It's not possible to change that because of compatibility. I'll fix the docs.
Regarding OpenSSL::ASN1::Integer.new(5).value returning Integer: it is because OpenSSL::ASN1::Primitive#initialize does not perform type checking. OpenSSL::ASN1::ASN1Data#value simply returns the value.
In OpenSSL gem 2.0.6 (using Ruby 2.4.2) and as far back as Ruby 2.2.1 (if not earlier), creating
OpenSSL::ASN1::Integer
instances usingOpenSSL::ASN1.decode
produces instances whosevalue
attribute is of typeOpenSSL::BN
, notNumber
(which should probably be documented asInteger
) as documented on the docs page forOpenSSL::ASN1::Primitive
(http://ruby-doc.org/stdlib-2.4.2/libdoc/openssl/rdoc/OpenSSL/ASN1/Primitive.html).Either
OpenSSL::ASN1.decode
should be modified to returnOpenSSL::ASN1::Integer
instances whosevalue
attribute is of typeInteger
, notOpenSSL::BN
. If this is not palatable from a backwards compatibility standpoint, this discrepancy should at least be documented.Code to reproduce:
Expected output:
Actual output:
The text was updated successfully, but these errors were encountered: