mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-01 02:46:20 -05:00
Avoid usage of deprecated function RSA_generate_key that make android
compiler mad
This commit is contained in:
parent
9a980def2c
commit
68a00138d2
@ -243,7 +243,10 @@ bool GxsSecurity::checkPublicKey(const RsTlvPublicRSAKey &key)
|
|||||||
bool GxsSecurity::generateKeyPair(RsTlvPublicRSAKey& public_key,RsTlvPrivateRSAKey& private_key)
|
bool GxsSecurity::generateKeyPair(RsTlvPublicRSAKey& public_key,RsTlvPrivateRSAKey& private_key)
|
||||||
{
|
{
|
||||||
// admin keys
|
// 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);
|
RSA *rsa_pub = RSAPublicKey_dup(rsa);
|
||||||
|
|
||||||
public_key.keyFlags = RSTLV_KEY_TYPE_PUBLIC_ONLY ;
|
public_key.keyFlags = RSTLV_KEY_TYPE_PUBLIC_ONLY ;
|
||||||
|
@ -105,11 +105,15 @@ X509_REQ *GenerateX509Req(
|
|||||||
fprintf(stderr,"GenerateX509Req: reverting to %d\n", nbits);
|
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))
|
if ((rsa == NULL) || !EVP_PKEY_assign_RSA(pkey, rsa))
|
||||||
throw std::runtime_error("Couldn't generate RSA Key");
|
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.
|
// open the file.
|
||||||
FILE *out;
|
FILE *out;
|
||||||
if (NULL == (out = RsDirUtil::rs_fopen(pkey_file.c_str(), "w")))
|
if (NULL == (out = RsDirUtil::rs_fopen(pkey_file.c_str(), "w")))
|
||||||
|
Loading…
Reference in New Issue
Block a user