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

OpenSSL::PKey::PKeyError when JOSE::JWK.generate_key([:rsa, 1024]) #24

Open
TC-SJ-Yoon opened this issue Aug 15, 2023 · 1 comment
Open

Comments

@TC-SJ-Yoon
Copy link

TC-SJ-Yoon commented Aug 15, 2023

Hello,

I've updated Ruby version from 3.0.2 to 3.2.2 on my Mac (Intel chip) with this

brew install [email protected]
ruby-install ruby-3.2.2 -- --with-openssl-dir=$(brew --prefix [email protected])
chruby 3.2.2

In the gem file I have...

gem 'jose'
gem 'jwt'

When I generate key like this..

jwk = JOSE::JWK.generate_key([:rsa, 1024])

I receive the error

Minitest::UnexpectedError: OpenSSL::PKey::PKeyError: EVP_PKEY_CTX_ctrl_str(ctx, "rsa_keygen_pubexp", "")

I'm not sure how to debug the issue. Could someone help me to figure out the issue?

@andrer0cha
Copy link

andrer0cha commented Oct 31, 2023

It seems that this is being triggered when generating any key using the gem.

I'm using a MacOS X with:

$ openssl version
OpenSSL 3.1.3 19 Sep 2023 (Library: OpenSSL 3.1.3 19 Sep 2023)

I tried:

JOSE::JWE.generate_key({"alg" => "RSA-OAEP-256", "enc" => "A256GCM"})
JOSE::JWE.generate_key({"alg" => "RSA-OAEP-256", "enc" => "A128GCM"})
JOSE::JWK.generate_key([:rsa, 2048])
JOSE::JWS.generate_key({"alg" => "RS256"})

All are throwing the same error.

When I try:

OpenSSL::PKey::EC.generate('prime256v1')

It works.

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

2 participants