Joe smith <[EMAIL PROTECTED]> wrote:
Hi,I have the following code#include <openssl/rsa.h>
#include <openssl/evp.h>
int main()
{
OpenSSL_add_all_algorithms();
ERR_load_crypto_strings();
ERR_print_errors_fp(stderr);
RSA *rsa;
BIO *publickey;
ERR_load_crypto_strings();
rsa = RSA_generate_key(1024, 65537, NULL, NULL);
char *passwd = "123456";
FILE *F1 = fopen("key.pem", "wb");
PEM_write_RSAPrivateKey(F1, rsa, EVP_des_cbc(), NULL, 0, NULL, passwd);
// PEM_write_bio_RSAPublicKey(publickey,rsa);
fclose(F1);
FILE *F2 = fopen("key.pem", "rb");
RSA *rsa_2;
rsa_2 = PEM_read_RSAPrivateKey(F2, NULL, NULL, passwd);
char str[256];
ERR_error_string(ERR_get_error(), str);
printf(str);
}
but i am getting the following error
error:00000000:lib(0):func(0):reason(0)
Any suggestions,
Thanks
Joe
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!