instance method
OpenSSL::X509::Certificate#check_private_key
(::OpenSSL::PKey::PKey key) -> bool
cert.check_private_key(key) → true | false
ext/openssl/ossl_x509cert.c
View on GitHub ↗
static VALUE
ossl_x509_check_private_key(VALUE self, VALUE key)
{
X509 *x509;
EVP_PKEY *pkey;
/* not needed private key, but should be */
pkey = GetPrivPKeyPtr(key); /* NO NEED TO DUP */
GetX509(self, x509);
if (!X509_check_private_key(x509, pkey)) {
ossl_clear_error();
return Qfalse;
}
return Qtrue;
}
Returns true if key is the corresponding private key to the Subject Public Key Information, false otherwise.