Hi,

I need to set app data to an RSA object encapsulated in an EVP_PKEY, so I did the following:

void set_app_data(EVP_PKEY *pkey)
{
        ...
        rsa = EVP_PKEY_get1_RSA(pkey);
        RSA_set_app_data(rsa, app_data);
        RSA_free(rsa);
        ...
}

We shouldn't access pkey->pkey.rsa directly and the only "get" method I could find is EVP_PKEY_get1_RSA(). I've looked into this function and it up ref the RSA object, and becoz of this I guess I have to call RSA_free() once I am done with the RSA object.

But from the codes, it looks weird that I am free'ing the RSA object reference after doing something to it, as if negating the work of RSA_set_app_data(). Is there a better way to do this?

Thanks... ET
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to