Closed seconoid closed 8 months ago
This is a change in OpenSSL 3.2 (the C library, not ruby/openssl) to mitigate a timing attack with PKCS#1 v1.5 padding. It is also backported to older versions as a security fix in some distributions, such as Fedora or Ubuntu.
https://www.openssl.org/docs/man3.2/man3/EVP_PKEY_decrypt.html
You can use wrong_private_key.decrypt(encrypted_str, rsa_pkcs1_implicit_rejection: 0)
if the old behavior is absolutely necessary. This option is documented in https://www.openssl.org/docs/man3.2/man1/openssl-pkeyutl.html
thanks!
Hi,
Is there a way to determine if the wrong key is being used when decrypting a string? In ruby 2.7, when a different key was used, it would raise
OpenSSL::PKey::RSAError
.ruby 2.7.6 and OpenSSL 2.1.3
However, when upgrading to ruby 3, even if the wrong key is used,
OpenSSL::PKey::RSAError
no longer occurs.ruby 3.2.3 and OpenSSL 3.1.0
I'm not sure if this is a specification or a bug, but I would like to know if there is a way to determine it.