WIP: support configurable certificates/keys, and root trust CAs (#114)
* wip: tls options implemented in openssl * update naming, remove #define guard * assert compiled with USE_TLS for tls options * apply autoformatter * include tls options impl * style cleanup; auto ssl_err * ssl_err -> sslErr * be explicit about SSL_VERIFY_NONE
This commit is contained in:
committed by
Benjamin Sergeant
parent
ed4be773a2
commit
408ee41990
@ -8,6 +8,7 @@
|
||||
|
||||
#include "IXCancellationRequest.h"
|
||||
#include "IXSocket.h"
|
||||
#include "IXSocketTLSOptions.h"
|
||||
#include <mutex>
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/conf.h>
|
||||
@ -20,7 +21,7 @@ namespace ix
|
||||
class SocketOpenSSL final : public Socket
|
||||
{
|
||||
public:
|
||||
SocketOpenSSL(int fd = -1);
|
||||
SocketOpenSSL(const SocketTLSOptions& tlsOptions, int fd = -1);
|
||||
~SocketOpenSSL();
|
||||
|
||||
virtual bool connect(const std::string& host,
|
||||
@ -44,6 +45,8 @@ namespace ix
|
||||
SSL* _ssl_connection;
|
||||
SSL_CTX* _ssl_context;
|
||||
const SSL_METHOD* _ssl_method;
|
||||
SocketTLSOptions _tlsOptions;
|
||||
|
||||
mutable std::mutex _mutex; // OpenSSL routines are not thread-safe
|
||||
|
||||
static std::once_flag _openSSLInitFlag;
|
||||
|
Reference in New Issue
Block a user