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)


178
179
180
181
182
183
184
185
186
187
188
# File 'ossl_pkey_dh.c', line 178

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

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

    return bn ? Qtrue : Qfalse;
}