Use OpenSSL in C++Builder
问题 I'm compiling an app in C++Builder 10 Seattle, and trying to use OpenSSL for RSA work. I followed this tutorial: How to Use OpenSSL to Generate RSA Keys in C/C++ Here is the code: #include <stdio.h> #include <openssl/rsa.h> #include <openssl/pem.h> bool generate_key() { int ret = 0; RSA *r = NULL; BIGNUM *bne = NULL; BIO *bp_public = NULL, *bp_private = NULL; int bits = 2048; unsigned long e = RSA_F4; // 1. generate rsa key bne = BN_new(); ret = BN_set_word(bne,e); if(ret != 1){ goto free_all