End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
OpenSSL::PKey::RSA#public_decrypt
rsa.public_decrypt(string) → String
rsa.public_decrypt(string, padding) → String
ext/openssl/lib/openssl/pkey.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.1.3/ext/openssl/lib/openssl/pkey.rb, line 394
def public_decrypt(string, padding = PKCS1_PADDING)
n or raise OpenSSL::PKey::RSAError, "incomplete RSA"
begin
verify_recover(nil, string, {
"rsa_padding_mode" => translate_padding_mode(padding),
})
rescue OpenSSL::PKey::PKeyError
raise OpenSSL::PKey::RSAError, $!.message
end
end
Decrypt string, which has been encrypted with the private key, with the public key. padding defaults to PKCS1_PADDING.
Deprecated in version 3.0. Consider using PKey::PKey#sign_raw and PKey::PKey#verify_raw, and PKey::PKey#verify_recover instead.
See also
#public?
#public_encrypt
#private_encrypt
#public_key
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0