Method: OpenSSL::PKey::DH#public?

Defined in:
ossl_pkey_dh.c

#public?Boolean

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

Returns:

  • (Boolean)

283
284
285
286
287
288
289
290
291
292
293
# File 'ossl_pkey_dh.c', line 283

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

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

    return bn ? Qtrue : Qfalse;
}