Skip to content

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

instance method

OpenSSL::PKey::RSA#to_pem

rsa.to_pem([cipher, pass_phrase]) => PEM-format String

Alias of #export

Outputs this keypair in PEM encoding. If cipher and pass_phrase are given they will be used to encrypt the key. cipher must be an OpenSSL::Cipher instance.

See also #export #to_der #to_s #sign_pss also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0