Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

OpenSSL::PKey::PKey#private_to_der

(::String cipher, ::String password) -> ::String
() -> ::String
pkey.private_to_der → string
pkey.private_to_der(cipher, password) → string

Serializes the private key to DER-encoded PKCS #8 format. If called without arguments, unencrypted PKCS #8 PrivateKeyInfo format is used. If called with a cipher name and a password, PKCS #8 EncryptedPrivateKeyInfo format with PBES2 encryption scheme is used.

See also #oid #private_to_pem #inspect #public_to_der also in 4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0