instance method
OpenSSL::PKey::EC#to_der
() -> ::String
key.to_der => String
ext/openssl/ossl_pkey_ec.c
View on GitHub ↗
static VALUE
ossl_ec_key_to_der(VALUE self)
{
OSSL_3_const EC_KEY *ec;
GetEC(self, ec);
if (EC_KEY_get0_public_key(ec) == NULL)
ossl_raise(ePKeyError, "can't export - no public key set");
if (EC_KEY_get0_private_key(ec))
return ossl_pkey_export_traditional(0, NULL, self, 1);
else
return ossl_pkey_export_spki(self, 1);
}
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 SEC 1/RFC 5915 ECPrivateKey format is required.
Consider using public_to_der or private_to_der instead.