Method: OpenSSL::PKey::DH#private?

Defined in:
ossl_pkey_dh.c

#private?Boolean

Indicates whether this DH instance has a private key associated with it or not. The private key may be retrieved with DH#priv_key.

Returns:

  • (Boolean)
[View source]

302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
# File 'ossl_pkey_dh.c', line 302

static VALUE
ossl_dh_is_private(VALUE self)
{
    DH *dh;
    const BIGNUM *bn;

    GetDH(self, dh);
    DH_get0_key(dh, NULL, &bn);

#if !defined(OPENSSL_NO_ENGINE)
    return (bn || DH_get0_engine(dh)) ? Qtrue : Qfalse;
#else
    return bn ? Qtrue : Qfalse;
#endif
}