Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

OpenSSL::PKey::RSA#private_encrypt

rsa.private_encrypt(string) => String
rsa.private_encrypt(string, padding) => String

Encrypt string with the private key. padding defaults to PKCS1_PADDING. The encrypted string output can be decrypted using public_decrypt.