生成对应的私钥和公钥
#include<iostream>
#include<openssl/sha.h>
#include<openssl/rsa.h>
#include<openssl/pem.h>
#include<unistd.h>
#include<stdlib.h>
#include<string.h>
#include<string>
extern "C"
{
// #include<openssl/
}
using namespace std;
void rsaTest()
{
RSA* rsa = RSA_new();
BIGNUM* e = BN_new();
int ret = BN_set_word(e, 12345);
ret = RSA_generate_key_ex(rsa, 1024, e, NULL);
// write privatek key to dis
BIO* bio = BIO_new_file("private2.pem", "w");
PEM_write_bio_RSAPrivateKey(bio, rsa, NULL, NULL, 0, NULL, NULL);
BIO_free(bio);
bio = BIO_new_file("public2.pem", "w");
PEM_write_bio_RSAPublicKey(bio, rsa);
BIO_free(bio);
FILE* fd = fopen("pbulic.pem", "w");
if (fd == NULL)
{
perror("file");
}
ret = PEM_write_RSAPublicKey(fd, rsa);
fclose(fd);
fd = fopen("private.pem", "w"