Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

JRuby 1.7.8 fails to initialize OpenSSL::PKey::RSA.new with encrypted key #1238

Closed
rsim opened this Issue · 3 comments

2 participants

Raimonds Simanovskis Charles Oliver Nutter
Raimonds Simanovskis

The following code (took example encrypted key from http://jira.codehaus.org/browse/JRUBY-6622) fails on JRuby 1.7.8

require "openssl"
pem = <<-EOS
-----BEGIN ENCRYPTED PRIVATE KEY-----
MIICxjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIaYgszaX31yECAggA
MBQGCCqGSIb3DQMHBAij3LmXGCmB8wSCAoDcLnAeXiBugFmwXd3wrvznlKvwHkP2
76lIrTiwDRZOLuaKHdBgNQDJ3NP+UPGdM7YEyNqdfdbN/3cLd0qfzeobuU+c/lGI
aE5pAwlWm5lK9boTsJnCqaDFEgJz2khZF+7RqYQVSG7MTM9SnIRNScLKjhTk7AaF
PD2qSnMVtixw/VfwdzhUknuwP2monLY8Ip/l9abicmBp9HGQ+0WA/nKQLQ/egWG0
S6rrXsH91exaxL7gcZL8jF+Ub7VDt4Hvx1RB/3r12k7AQGsK+TyIrKQFUllSnSq/
eFwBqpLSKWYyGJZlkJzW5MTHyeXqpTvav6T7e2mKZ4GG/a8THoWxLLrKeODFFoWn
LQNOQZ2Axa15E0TdeSkaumsOWPJm5DgFxf/1cRNxhJqYdX68QjWXeNS2SXPZBwlx
HCaAYo6OoCHZQ7O/3MpiT3rUAk30fbSa09VSvrenYi5s5lPieKFt3QZI44uGvi9j
MXyN4fkjzzXasE0xZzf6bQLS6aM+ucyQ8CMv0oAgAndoeKu10Ha4KmdT5dZf3LHj
BUXZDYp3Q5UF6ePyxKBdAqJf4PNKl4+VehYJ4eQ6CIQiSxSuWv9T+2b90PyDuRkz
sB1XZpeDD6dhQuU9GjdwCTyatITcm97ZkbdZEoQiDpiWQB4parTvKLKbD4AbP/+E
08btPFgXNocFUjLb5lB4Y/6RqaQxY7VoaFOPOfPpWPXF26X9Y5y3y+ymXdYFpkhp
wGBGScH+dutQWHoRV1TWUjv9a7CuzUxCX2Hrjooz1BtOnG8CoPA7K43+kvire5jN
529p6u+FtUZPUWLm5L5WHBUECEtJGw3ImjosX1HtoM/rW34XDmMHuN0u
-----END ENCRYPTED PRIVATE KEY-----
EOS
pem_password = "password"
OpenSSL::PKey::RSA.new(pem, pem_password)

with exception

OpenSSL::PKey::RSAError: Neither PUB key nor PRIV key:
    from org/jruby/ext/openssl/PKeyRSA.java:283:in `initialize'
    from (irb):22:in `evaluate'
    from org/jruby/RubyKernel.java:1123:in `eval'
    from org/jruby/RubyKernel.java:1519:in `loop'
    from org/jruby/RubyKernel.java:1284:in `catch'
    from org/jruby/RubyKernel.java:1284:in `catch'
    from /Users/raymond/.rvm/rubies/jruby-1.7.8/bin/irb:13:in `(root)'

The same code works without any exceptions on JRuby 1.7.6.

Charles Oliver Nutter
Owner

Shouldn't be hard to bisect and figure out what we broke.

Charles Oliver Nutter
Owner

How strange... I bisected it to this commit by @voxik, which seems so simple: 941ab04

Going to look into these APIs to see if perhaps there's a behavioral change missed.

Charles Oliver Nutter
Owner

The problem appears to be in the last part of that diff, where it tries to get an ASN1OctetString. I'm not sure what the behavioral difference is between the old and new code, so I'm going to revert that line and we'll explore doing it right for 1.7.10.

Charles Oliver Nutter headius closed this in 737ad5a
Ari Maniatis ari referenced this issue from a commit in ari/jobsworth
Ari Maniatis ari Upgrade to jruby 1.7.9 for a bunch of bug fixed. http://jruby.org/201…
…3/12/06/jruby-1-7-9.html

In particular I've run into jruby/jruby#1238 in my dev environment.
1ecaa37
Karol Bucek kares referenced this issue from a commit in kares/jruby
Karol Bucek kares de-ja-vu BC 1.49 (binary) compatibility while still maintaining 1.47 …
…compatibility

- a better 941ab04 (part) which got reverted
- tested #1238 regression - fine on 1.47 as well as 1.49 with this change
55956e7
Karol Bucek kares referenced this issue from a commit in kares/jruby
Karol Bucek kares de-ja-vu BC 1.49 (binary) compatibility while still maintaining 1.47 …
…compatibility

- a better 941ab04 (part) which got reverted
- tested #1238 regression - fine on 1.47 as well as 1.49 with this change
cbd7e4a
Christian Meier mkristian referenced this issue from a commit
Karol Bucek kares de-ja-vu BC 1.49 (binary) compatibility while still maintaining 1.47 …
…compatibility

- a better 941ab04 (part) which got reverted
- tested #1238 regression - fine on 1.47 as well as 1.49 with this change
85c804b
Christian Meier mkristian referenced this issue from a commit
Karol Bucek kares de-ja-vu BC 1.49 (binary) compatibility while still maintaining 1.47 …
…compatibility

- a better 941ab04 (part) which got reverted
- tested #1238 regression - fine on 1.47 as well as 1.49 with this change
3cb5850
Christian Meier mkristian referenced this issue from a commit
Karol Bucek kares de-ja-vu BC 1.49 (binary) compatibility while still maintaining 1.47 …
…compatibility

- a better 941ab04 (part) which got reverted
- tested #1238 regression - fine on 1.47 as well as 1.49 with this change
d5109d6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.