instance method
OpenSSL::PKey::EC#private_key=
(::OpenSSL::bn priv_key) -> self
key.private_key = openssl_bn
ext/openssl/ossl_pkey_ec.c
View on GitHub ↗
static VALUE ossl_ec_key_set_private_key(VALUE self, VALUE private_key)
{
#ifdef OSSL_HAVE_IMMUTABLE_PKEY
rb_raise(ePKeyError, "pkeys are immutable on OpenSSL 3.0");
#else
EC_KEY *ec;
BIGNUM *bn = NULL;
GetEC(self, ec);
if (!NIL_P(private_key))
bn = GetBNPtr(private_key);
switch (EC_KEY_set_private_key(ec, bn)) {
case 1:
break;
case 0:
if (bn == NULL)
break;
/* fallthrough */
default:
ossl_raise(ePKeyError, "EC_KEY_set_private_key");
}
return private_key;
#endif
}
See the OpenSSL documentation for EC_KEY_set_private_key()