Avoid usage of deprecated function RSA_generate_key that make android

compiler mad
This commit is contained in:
Gio 2016-08-23 03:11:49 +02:00
parent 9a980def2c
commit 68a00138d2
2 changed files with 9 additions and 2 deletions

View File

@ -243,7 +243,10 @@ bool GxsSecurity::checkPublicKey(const RsTlvPublicRSAKey &key)
bool GxsSecurity::generateKeyPair(RsTlvPublicRSAKey& public_key,RsTlvPrivateRSAKey& private_key)
{
// admin keys
RSA *rsa = RSA_generate_key(2048, 65537, NULL, NULL);
BIGNUM *ebn = BN_new();
BN_set_word(ebn, 65537);
RSA *rsa = RSA_new();
RSA_generate_key_ex(rsa, 2048, ebn, NULL);
RSA *rsa_pub = RSAPublicKey_dup(rsa);
public_key.keyFlags = RSTLV_KEY_TYPE_PUBLIC_ONLY ;

View File

@ -105,11 +105,15 @@ X509_REQ *GenerateX509Req(
fprintf(stderr,"GenerateX509Req: reverting to %d\n", nbits);
}
rsa = RSA_generate_key(nbits, e, NULL, NULL);
rsa = RSA_new();
if ((rsa == NULL) || !EVP_PKEY_assign_RSA(pkey, rsa))
throw std::runtime_error("Couldn't generate RSA Key");
BIGNUM *ebn = BN_new();
BN_set_word(ebn, e);
RSA_generate_key_ex(rsa, nbits, ebn, NULL);
// open the file.
FILE *out;
if (NULL == (out = RsDirUtil::rs_fopen(pkey_file.c_str(), "w")))