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
require'openssl'require'base64'# Build the CSRkey=OpenSSL::PKey::RSA.new(1024)request=OpenSSL::X509::Request.newrequest.subject=OpenSSL::X509::Name.new([['CN',"common_name",OpenSSL::ASN1::UTF8STRING]])request.public_key=key.public_keyrequest.sign(key,OpenSSL::Digest::SHA1.new)# One request is decoded from a `encode64` the other one is from `strict_encode64`decoded=Base64.decode64(Base64.encode64(request.to_der))strictly_decoded=Base64.decode64(Base64.strict_encode64(request.to_der))# Both strings are decoded identicallydecoded == strictly_decoded#=> true# .. even on byte leveldecoded.split(//) == strictly_decoded.split(//)#= trueOpenSSL::X509::Request.new(decoded)#=> OpenSSL::X509::RequestError: invalid certificate request dataOpenSSL::X509::Request.new(strictly_decoded)#=> #<OpenSSL::X509::Request:0x4f290f46>
Not sure if this is strictly jruby-openssl issue, but how is it possible that two equal strings produce different results?
Environment:
jruby-9.1.13.0
MacOS Sierra 10.12.6
OpenSSL 0.9.8zh 14 Jan 2016
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
The text was updated successfully, but these errors were encountered:
seems that JOSSL is trying to eat up more data than 'really' passed in (for decoded case) :
java.lang.IllegalArgumentException: failed to construct sequence from byte[]: Extra data detected in stream
at org.bouncycastle.asn1.ASN1Sequence.getInstance(Unknown Source)
at org.bouncycastle.asn1.pkcs.CertificationRequest.getInstance(Unknown Source)
at org.jruby.ext.openssl.impl.PKCS10Request.<init>(PKCS10Request.java:108)
at org.jruby.ext.openssl.X509Request.initialize(X509Request.java:111)
Not sure if this is strictly
jruby-openssl
issue, but how is it possible that two equal strings produce different results?Environment:
jruby-9.1.13.0
MacOS Sierra 10.12.6
OpenSSL 0.9.8zh 14 Jan 2016
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
The text was updated successfully, but these errors were encountered: