Re: Openssl 3.0.0. EVP_PKEY RSA is NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 15/09/2021 00:19, Ken Goldman wrote:
I am doing the following, but the EVP_PKEY->pkey->rsa is null.
Am I misusing the API or missing a step?

Neither. This is normal. EVP_PKEY->pkey->rsa is only used if you have a legacy key.

Matt


(error checking removed)

     EVP_PKEY        *rsa_pub_key = NULL;
     EVP_PKEY_CTX     *ctx = NULL;
     OSSL_PARAM_BLD     *param_bld = NULL;
     OSSL_PARAM         *params = NULL;

     BIGNUM *    n = NULL;
     BIGNUM *    e = NULL;

[these bignums are initialized using bin2bn]

     param_bld = OSSL_PARAM_BLD_new();
     irc = OSSL_PARAM_BLD_push_BN(param_bld, "n", n);
     irc = OSSL_PARAM_BLD_push_BN(param_bld, "e", e);
     params = OSSL_PARAM_BLD_to_param(param_bld);

(do I perhaps need an 'end'?

     ctx = EVP_PKEY_CTX_new_from_name(NULL, "RSA", NULL);
     irc = EVP_PKEY_fromdata_init(ctx);
    irc = EVP_PKEY_fromdata(ctx, (EVP_PKEY **)rsa_pub_key,        /* freed by caller */
                 EVP_PKEY_PUBLIC_KEY, params);

Probing rsa_pub_key here in the debugger.


type = 6
references = 1
rsa = 0  (probably NULL)




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux