0
votes

I created a private key with: openssl genrsa -des3 -out private.pem 2048

During the key creation I was asked to enter and verify a password.

I used the following code to create an RSA from the key but got: r=NULL.

Can you please help ?

Thank you, Zvika

RSA *r;

fd = fopen ("private.pem","r");
r = PEM_read_RSAPrivateKey(fd, &r, NULL, "1234");
fclose (fd);
1

1 Answers

0
votes

I added the following code:

OpenSSL_add_all_algorithms();
    OpenSSL_add_all_ciphers();
    ERR_load_crypto_strings();

Found the solution here at: PEM_read_RSAPrivateKey function returns NULL

Now it works.

Thank you, Zvika