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::RSA.generate always returns a OpenSSL::PKey::RSA, even when sublcassed, on Ruby 3.1/openssl-3.0.0 #512

Open
postmodern opened this issue May 9, 2022 · 1 comment

Comments

@postmodern
Copy link
Member

I noticed a change in behavior for OpenSSL::PKey::RSA.generate between Ruby 3.0 (openssl-2.x) and ruby 3.1 (openssl-3.0.0). In Ruby 3.1 OpenSSL::PKey::RSA.generate will always return a OpenSSL::PKey::RSA instance, even when the class has been sublcassed.

Steps To Reproduce

require 'openssl'

class MyRSA < OpenSSL::PKey::RSA
end

p MyRSA.generate(1024)

Expected Behavior

#<MyRSA:...>

Actual Behavior

#<OpenSSL::PKey::RSA:...>

Version

  • Ruby 3.0 (Works):
    • ruby 3.0.4p208 (2022-04-12 revision 3fa771dded) [x86_64-linux]
    • `openssl (default: 2.2.1)
  • Ruby 3.1 (Fails):
    • ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
    • openssl (default: 3.0.0)

This regression seems to have appeared in 3.0.0.

@postmodern
Copy link
Member Author

Also effects OpenSSL::PKey::DSA as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant