Encapsulates an OpenSSL context (SSL_CTX) with optional logging. More...
#include <ssl.hpp>
Public Member Functions | |
TSslContext (TSslContext &&other) | |
Static Public Member Functions | |
static TSslContext | Client (const std::function< void(const char *)> &logFunc={}) |
Creates a client SSL context. | |
static TSslContext | Server (const char *certfile, const char *keyfile, const std::function< void(const char *)> &logFunc={}) |
Creates a server SSL context using certificate and key files. | |
static TSslContext | ServerFromMem (const void *certfile, const void *keyfile, const std::function< void(const char *)> &logFunc={}) |
Creates a server SSL context from in-memory certificate and key data. | |
Public Attributes | |
SSL_CTX * | Ctx |
The underlying OpenSSL context. | |
std::function< void(const char *)> | LogFunc = {} |
Optional logging callback. | |
Encapsulates an OpenSSL context (SSL_CTX) with optional logging.
TSslContext holds a pointer to an OpenSSL SSL_CTX, which is used to configure SSL/TLS parameters. It optionally accepts a logging function to report state changes or errors during SSL operations.
The context can be created for client or server mode:
The context is movable but not copyable. Upon destruction, any associated resources are released.
|
static |
Creates a client SSL context.
logFunc | Optional logging function. |
|
static |
Creates a server SSL context using certificate and key files.
certfile | Path to the certificate file. |
keyfile | Path to the key file. |
logFunc | Optional logging function. |
|
static |
Creates a server SSL context from in-memory certificate and key data.
certfile | Pointer to the certificate data in memory. |
keyfile | Pointer to the key data in memory. |
logFunc | Optional logging function. |