Skip to content
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

Unable to import an exported OpenSSL::PKey::EC key #256

Open
postmodern opened this issue May 10, 2022 · 0 comments
Open

Unable to import an exported OpenSSL::PKey::EC key #256

postmodern opened this issue May 10, 2022 · 0 comments

Comments

@postmodern
Copy link

postmodern commented May 10, 2022

I cannot seem to be able to import an exported PEM encoded OpenSSL::PKey::EC key.

Steps To Reproduce

ec = OpenSSL::PKey::EC.new('prime256v1')
ec.generate_key
pem = ec.to_pem
# => "-----BEGIN EC PRIVATE KEY-----\nMCUCAQEEID5wHE2lScjVvIkAcVXJWw5al+Jl8k7OiS+t8zAB1pOE\n-----END EC PRIVATE KEY-----\n"

ec2 = OpenSSL::PKey::EC.new(pem)

Expected Result

#<OpenSSL::PKey::EC:...>

Actual Result

Traceback (most recent call last):
       10: from /opt/rubies/jruby-9.3.2.0/bin/irb:23:in `<main>'
        9: from org/jruby/RubyKernel.java:1052:in `load'
        8: from /opt/rubies/jruby-9.3.2.0/lib/ruby/gems/shared/gems/irb-1.0.0/exe/irb:11:in `<main>'
        7: from org/jruby/RubyKernel.java:1237:in `catch'
        6: from org/jruby/RubyKernel.java:1237:in `catch'
        5: from org/jruby/RubyKernel.java:1507:in `loop'
        4: from org/jruby/RubyKernel.java:1091:in `eval'
        3: from (irb):6:in `evaluate'
        2: from org/jruby/RubyClass.java:886:in `new'
        1: from org/jruby/ext/openssl/PKeyEC.java:326:in `initialize'
OpenSSL::PKey::ECError (Neither PUB key nor PRIV key:)

Version

  • jruby 9.3.2.0 (2.6.8) 2021-12-01 0b8223f905 OpenJDK 64-Bit Server VM 11.0.15+10 on 11.0.15+10 +jit [linux-x86_64]
  • jruby-openssl (0.12.2 java, default: 0.11.0 java)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant