Skip to content

OpenSSL::PKey::PKeyError when using PEM private key #17

@adicaff

Description

@adicaff

stack:
Ruby 2.7.0
rails 6.0.3.5
openssl 2.2.1
jose 1.1.3

While doing JOSE::JWK.from_pem_file(private_key) i got:
Could not parse PKey: no start line (OpenSSL::PKey::PKeyError)

error is in jose-1.1.3/lib/jose/jwk/pem.rb:6:

and trace:

3: from jose-1.1.3/lib/jose/jwk.rb:247:in `from_pem_file'
2: from jose-1.1.3/lib/jose/jwk.rb:237:in `from_pem'
1: from jose-1.1.3/lib/jose/jwk/pem.rb:6:in `from_binary'

The private key is OK, I have tested it using clients software and I can perfectly decrypt payloads. This error comes up only when using the gem on rails project.
Any sights on what can be happening? Any possible solution?
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions