How to access different fields of typedef struct evp_pkey_st EVP_PKEY.

Matt Caswell matt at openssl.org
Tue Apr 20 10:58:50 UTC 2021



On 20/04/2021 11:45, Kumar Mishra, Sanjeev wrote:
> Hi,
> I am not getting different functions in OpenSSL 3.0 for accessing 
> different fields of typedef struct evp_pkey_st EVP_PKEY. For Example - 
> code is like this -
> EVP_PKEY * privKey;
> -----
> -----
> if ( BN_cmp(privKey->pkey.rsa->n, pubKey->pkey.rsa->n) != 0 )

BIGNUM *privn = NULL, *pubn = NULL;

/* Error handling omitted for brevity...*/
EVP_PKEY_get_bn_param(privKey, "n", &privn);
EVP_PKEY_get_bn_param(pubKey, "n", &pubKey);
if ( BN_cmp(privn, pubn) != 0)

...
BN_free(privn);
BN_free(pubn);

> ----
> ----
> else if ((privKey->type == EVP_PKEY_EC) && (pubKey->type == EVP_PKEY_EC))


else if (EVP_PKEY_is_a(privKey, "EC") && (EVP_PKEY_is_a(pubKey, "EC"))



Matt


More information about the openssl-users mailing list