Net module

SSLManager

Singleton that owns the default client/server TLS contexts and related callbacks.

#include <icy/net/sslmanager.h>

class SSLManager

Defined in src/net/include/icy/net/sslmanager.h:31

Friends


Singleton< SSLManager >

friend class Singleton< SSLManager >

Defined in src/net/include/icy/net/sslmanager.h:122


SSLContext

friend class SSLContext

Defined in src/net/include/icy/net/sslmanager.h:125

Public Attributes

ReturnNameDescription
ThreadSignal< void(VerificationErrorDetails &)>ServerVerificationErrorFired whenever a certificate verification error is detected by the server during a handshake.
ThreadSignal< void(VerificationErrorDetails &)>ClientVerificationErrorFired whenever a certificate verification error is detected by the client during a handshake.
ThreadSignal< void(std::string &)>PrivateKeyPassphraseRequiredFired when an encrypted certificate or private key is loaded. Not setting the password in the event parameter will result in a failure to load the certificate.

ServerVerificationError

ThreadSignal< void(VerificationErrorDetails &)> ServerVerificationError

Type: ThreadSignal< void(VerificationErrorDetails &)>

Defined in src/net/include/icy/net/sslmanager.h:49

Fired whenever a certificate verification error is detected by the server during a handshake.


ClientVerificationError

ThreadSignal< void(VerificationErrorDetails &)> ClientVerificationError

Type: ThreadSignal< void(VerificationErrorDetails &)>

Defined in src/net/include/icy/net/sslmanager.h:53

Fired whenever a certificate verification error is detected by the client during a handshake.


PrivateKeyPassphraseRequired

ThreadSignal< void(std::string &)> PrivateKeyPassphraseRequired

Type: ThreadSignal< void(std::string &)>

Defined in src/net/include/icy/net/sslmanager.h:57

Fired when an encrypted certificate or private key is loaded. Not setting the password in the event parameter will result in a failure to load the certificate.

Public Methods

ReturnNameDescription
voidinitializeServerInitializes the server side of the SSLManager server-side SSLContext.
voidinitializeClientInitializes the client side of the SSLManager with a default client-side SSLContext.
SSLContext::PtrdefaultServerContextReturns the default context used by the server if initialized.
SSLContext::PtrdefaultClientContextReturns the default context used by the client if initialized.
voidshutdownShuts down the SSLManager and releases the default context objects. After a call to shutdown(), the SSLManager can no longer be used.

initializeServer

void initializeServer(SSLContext::Ptr ptrContext)

Defined in src/net/include/icy/net/sslmanager.h:35

Initializes the server side of the SSLManager server-side SSLContext.


initializeClient

void initializeClient(SSLContext::Ptr ptrContext)

Defined in src/net/include/icy/net/sslmanager.h:39

Initializes the client side of the SSLManager with a default client-side SSLContext.


defaultServerContext

SSLContext::Ptr defaultServerContext()

Defined in src/net/include/icy/net/sslmanager.h:42

Returns the default context used by the server if initialized.


defaultClientContext

SSLContext::Ptr defaultClientContext()

Defined in src/net/include/icy/net/sslmanager.h:45

Returns the default context used by the client if initialized.


shutdown

void shutdown()

Defined in src/net/include/icy/net/sslmanager.h:66

Shuts down the SSLManager and releases the default context objects. After a call to shutdown(), the SSLManager can no longer be used.

Normally, it's not necessary to call this method directly, as this will be called either by uninitializeSSL(), or when the SSLManager instance is destroyed.

Public Static Methods

ReturnNameDescription
SSLManager &instance staticReturns the instance of the SSLManager singleton.
voiddestroy staticShuts down and destroys the SSLManager singleton instance.
voidinitNoVerifyClient staticInitializes a default no-verify client context that's useful for testing.
voidinitNoVerifyServer staticInitializes a default no-verify server context that's useful for testing. Optionally accepts private key and certificate file paths for server identity; if omitted, no certificate is loaded.

instance

static

static SSLManager & instance()

Defined in src/net/include/icy/net/sslmanager.h:69

Returns the instance of the SSLManager singleton.


destroy

static

static void destroy()

Defined in src/net/include/icy/net/sslmanager.h:72

Shuts down and destroys the SSLManager singleton instance.


initNoVerifyClient

static

static void initNoVerifyClient()

Defined in src/net/include/icy/net/sslmanager.h:76

Initializes a default no-verify client context that's useful for testing.


initNoVerifyServer

static

static void initNoVerifyServer(const std::string & privateKeyFile = "", const std::string & certificateFile = "")

Defined in src/net/include/icy/net/sslmanager.h:81

Initializes a default no-verify server context that's useful for testing. Optionally accepts private key and certificate file paths for server identity; if omitted, no certificate is loaded.

Private Attributes


_defaultServerContext

SSLContext::Ptr _defaultServerContext

Type: SSLContext::Ptr

Defined in src/net/include/icy/net/sslmanager.h:120


_defaultClientContext

SSLContext::Ptr _defaultClientContext

Type: SSLContext::Ptr

Defined in src/net/include/icy/net/sslmanager.h:121


_mutex

std::mutex _mutex

Defined in src/net/include/icy/net/sslmanager.h:122

Private Methods

ReturnNameDescription
SSLManagerCreates the SSLManager.
~SSLManager noexceptDestroys the SSLManager.
SSLManagerDeleted constructor.
SSLManager &operator=Deleted assignment operator.
SSLManagerDeleted constructor.
SSLManager &operator=Deleted assignment operator.

SSLManager

SSLManager()

Defined in src/net/include/icy/net/sslmanager.h:105

Creates the SSLManager.


~SSLManager

noexcept

~SSLManager() noexcept

Defined in src/net/include/icy/net/sslmanager.h:108

Destroys the SSLManager.


SSLManager

SSLManager(const SSLManager &) = delete

Defined in src/net/include/icy/net/sslmanager.h:110

Deleted constructor.


operator=

SSLManager & operator=(const SSLManager &) = delete

Defined in src/net/include/icy/net/sslmanager.h:111

Deleted assignment operator.


SSLManager

SSLManager(SSLManager &&) = delete

Defined in src/net/include/icy/net/sslmanager.h:112

Deleted constructor.


operator=

SSLManager & operator=(SSLManager &&) = delete

Defined in src/net/include/icy/net/sslmanager.h:113

Deleted assignment operator.

Private Static Methods

ReturnNameDescription
intverifyCallback staticThe return value of this method defines how errors in verification are handled. Return 0 to terminate the handshake, or 1 to continue despite the error.

verifyCallback

static

static int verifyCallback(bool server, int ok, X509_STORE_CTX * pStore)

Defined in src/net/include/icy/net/sslmanager.h:118

The return value of this method defines how errors in verification are handled. Return 0 to terminate the handshake, or 1 to continue despite the error.