Skip to content

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

Open
@postmodern

Description

@postmodern

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Unable to import an exported `OpenSSL::PKey::EC` key · Issue #256 · jruby/jruby-openssl