Jake
Jake

Reputation: 16837

OpenSSL: Unable to create SSL_CTX * using SSL_CTX_new()

Following the instructions on page , I am trying to use openSSL to connect client/server in secure manner.

I am not able to create the SSL_CTX as follows:

 /* OpenSSL headers */

 #include "openssl/bio.h"
 #include "openssl/ssl.h"
 #include "openssl/err.h"

 int main()
 {

       /* Initializing OpenSSL */

       SSL_load_error_strings();
       ERR_load_BIO_strings();
       OpenSSL_add_all_algorithms();

       SSL_CTX * ctx = SSL_CTX_new(SSLv23_client_method());

       .....
  }

The ctx reference always turns out to be NULL. Can anyone please tell what step am I missing?

Thanks.

Update

On checking error, the message was

 Error: library has no ciphers

Upvotes: 11

Views: 10558

Answers (1)

Jake
Jake

Reputation: 16837

I used the following call at start of main() function:

SSL_library_init();

Solution found at: here

Upvotes: 17

Related Questions