Method: OpenSSL::PKey::RSA#to_der

Defined in:
ossl_pkey_rsa.c

#to_derDER-format String

Serializes a private or public key to a DER-encoding.

See #to_pem for details.

This method is kept for compatibility. This should only be used when the PKCS #1 RSAPrivateKey format is required.

Consider using #public_to_der or #private_to_der instead.

Returns:

  • (DER-format String)


298
299
300
301
302
303
304
305
# File 'ossl_pkey_rsa.c', line 298

static VALUE
ossl_rsa_to_der(VALUE self)
{
    if (can_export_rsaprivatekey(self))
        return ossl_pkey_export_traditional(0, NULL, self, 1);
    else
        return ossl_pkey_export_spki(self, 1);
}