Failing to validate server certificate with OpenSSL
问题 I have written a SOAP client using OpenSSL (written in C++ on Ubuntu 12.04) but it currently works without checking the server security certificate. This is the function I am using to set up the connection and checking the certificate bool bInitialiseSSL(SSL_CTX* &ctx, SSL* &ssl, BIO* &bio) { ctx = SSL_CTX_new(SSLv23_client_method()); bio = BIO_new_ssl_connect(ctx); if (bio == NULL) { ERR_print_errors_fp(stderr); SSL_CTX_free(ctx); return false; } BIO_get_ssl(bio, &ssl); SSL_set_mode(ssl, SSL