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
One of the ways that OpenSSL::PKey::RSA.new may be called is with a PEM-formatted string and no password. For example, see rubygems/request.
In the MRI implementation, when OpenSSL::PKey::RSA.new is called with an PEM-formatted string containing an encrypted RSA key but no password, it opens /dev/tty to prompt the user for a pass phrase:
% rvm use ruby-2.1
Using /usr/local/rvm/gems/ruby-2.1.5
% ruby example.rb
Decrypting key using password "correct horse battery staple"
success
Decrypting key using password nil
Enter PEM pass phrase:
success
When JRuby attempts the same, it raises an error instead of attempting to prompt the user for a pass phrase:
% rvm use jruby
Using /usr/local/rvm/gems/jruby-1.7.19
% JRUBY_OPTS=-J-Djruby.openssl.debug=true ruby example.rb
Decrypting key using password "correct horse battery staple"
success
Decrypting key using password nil
java.io.IOException: problem creating RSA private key: java.io.IOException: Password is null, but a password is required
at org.jruby.ext.openssl.x509store.PEMInputOutput.readPrivateKey(PEMInputOutput.java:308)
at org.jruby.ext.openssl.PKeyRSA.initialize(PKeyRSA.java:237)
...
failure: Neither PUB key nor PRIV key:
org/jruby/ext/openssl/PKeyRSA.java:280:in `initialize'
example.rb:6:in `test'
example.rb:17:in `(root)'
there's some naive prompting implemented since jruby-openssl 0.9.14jruby/jruby-openssl@098ad46 ...
if more is needed please consider helping us out, thanks!
One of the ways that
OpenSSL::PKey::RSA.new
may be called is with a PEM-formatted string and no password. For example, see rubygems/request.In the MRI implementation, when
OpenSSL::PKey::RSA.new
is called with an PEM-formatted string containing an encrypted RSA key but no password, it opens/dev/tty
to prompt the user for a pass phrase:When JRuby attempts the same, it raises an error instead of attempting to prompt the user for a pass phrase:
Example code:
The text was updated successfully, but these errors were encountered: