Thomas Mangold wrote:
Why not just copy the key?EVP_PKEY *cp_key (EVP_PKEY *pkey) { /* error handling omittet */ EVP_PKEY *pnew; int key_type; pnew = EVP_PKEY_new(); switch(pkey->type) { case EVP_PKEY_RSA: DSA *dsa = EVP_PKEY_get1_DSA(pkey); EVP_PKEY_set1_DSA(pnew, dsa); break; case EVP_PKEY_DSA: RSA *rsa = EVP_PKEY_get1_RSA(pkey); EVP_PKEY_set1_RSA(pnew, rsa); break; case EVP_PKEY_DH: DH *dh = EVP_PKEY_get1_DH(pkey); EVP_PKEY_set1_DH(pnew, dh); break; case EVP_PKEY_EC: EC_KEY *ec = EVP_PKEY_get1_EC(pkey); EVP_PKEY_set1_EC(pnew, ec); break; default: fprintf(stderr, "unknown key type %.\n", pkey->type); } return pnew; } Thomas ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [email protected] Automated List Manager [EMAIL PROTECTED]
Hello, this way doesn't work in my case (i think) : EVP_PKEY* to = cp_key(from); cout << EVP_PKEY_cmp_parameters(from, to); this code displays -1, so i think the duplication doesn't word. ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [email protected] Automated List Manager [EMAIL PROTECTED]
