OSSL_STORE_CTX *ctx = OSSL_STORE_open(tpm_key_path, nullptr, nullptr, nullptr, nullptr);

OSSL_STORE_INFO *info;

while (!OSSL_STORE_eof(ctx)) { if ((info = OSSL_STORE_load(ctx)) == nullptr) { printf("Failed in OSSL_STORE_load : %d",res); } if ((key = OSSL_STORE_INFO_get1_PKEY(info)) == nullptr) { printf("Failed in OSSL_STORE_INFO_get1_PKEY : %d",res); } break; }

if(key) { if (ctx) { EVP_PKEY_decrypt_init(ctx); EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, NULL) EVP_PKEY_CTX_set_rsa_padding(ctx, padding); } }

error: cannot convert ‘OSSL_STORE_CTX*’ {aka ‘ossl_store_ctx_st*’} to ‘EVP_PKEY_CTX*’ {aka ‘evp_pkey_ctx_st*’} 335 | EVP_PKEY_decrypt_init(ctx); | ^~~ | | | OSSL_STORE_CTX* {aka ossl_store_ctx_st*}

1

There are 1 best solutions below

0
Shane Powell On

You need to use EVP_PKEY_CTX_new to create a EVP_PKEY_CTX* from the EVP_PKEY* value.

e.g.

EVP_PKEY_CTX* pctx = EVP_PKEY_CTX_new(key, nullptr);
if (pctx)
{
    EVP_PKEY_decrypt_init(pctx);