instance method
OpenSSL::PKey::RSA#private_decrypt
(::String data, ?::Integer padding) -> ::String
rsa.private_decrypt(string) → String
rsa.private_decrypt(string, padding) → String
ext/openssl/lib/openssl/pkey.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/ext/openssl/lib/openssl/pkey.rb, line 465
def private_decrypt(data, padding = PKCS1_PADDING)
n or raise PKeyError, "incomplete RSA"
private? or raise PKeyError, "private key needed."
decrypt(data, {
"rsa_padding_mode" => translate_padding_mode(padding),
})
end
Decrypt string, which has been encrypted with the public key, with the private key. padding defaults to PKCS1_PADDING, which is known to be insecure but is kept for backwards compatibility.
Deprecated in version 3.0. Consider using PKey::PKey#encrypt and PKey::PKey#decrypt instead.