SSL context.
More...
#include <SSLContext.h>
|
| SSLContext (const void *method) noexcept |
|
| ~SSLContext () noexcept |
|
void * | getContext () const noexcept |
|
bool | importCertFile (const char *file) const noexcept |
| Load certificate from file.
|
|
bool | importPrivateKeyFile (const char *file) const noexcept |
| Load private key from file.
|
|
bool | authPrivateKey () const noexcept |
| Verify certificate and private key.
|
|
Socket::Ptr | newSocketPtr (Socket::Family family, int32_t flags) |
| Create a TCP socket from the current context.
|
|
void * | release () noexcept |
| Release ownership of the current object.
|
|
std::unique_ptr< SSLContext > | copy () const noexcept |
| Deep copy the current context, including certificates and private keys (must exist), with independent lifecycle.
|
|
◆ Ptr
◆ Socket
◆ SSLContext() [1/2]
SSLContext::SSLContext |
( |
const void * | method | ) |
|
|
explicitnoexcept |
◆ ~SSLContext()
SSLContext::~SSLContext |
( |
| ) |
|
|
noexcept |
◆ SSLContext() [2/2]
sese::security::SSLContext::SSLContext |
( |
| ) |
|
|
privatedefault |
◆ authPrivateKey()
bool SSLContext::authPrivateKey |
( |
| ) |
const |
|
noexcept |
Verify certificate and private key.
- Returns
- Verification result
References context.
◆ copy()
std::unique_ptr< SSLContext > SSLContext::copy |
( |
| ) |
const |
|
noexcept |
Deep copy the current context, including certificates and private keys (must exist), with independent lifecycle.
- Returns
- SSL context
References context, and MAKE_UNIQUE_PRIVATE.
◆ getContext()
void * SSLContext::getContext |
( |
| ) |
const |
|
nodiscardnoexcept |
◆ getErrorCode()
◆ importCertFile()
bool SSLContext::importCertFile |
( |
const char * | file | ) |
const |
|
noexcept |
Load certificate from file.
- Parameters
-
file | Path to the certificate file |
- Returns
- Loading result
◆ importPrivateKeyFile()
bool SSLContext::importPrivateKeyFile |
( |
const char * | file | ) |
const |
|
noexcept |
Load private key from file.
- Note
- This function implements via
SSL_CTX_use_PrivateKey_file
, it will also verify the certificate
- Parameters
-
file | Path to the private key file |
- Returns
- Loading result
◆ newSocketPtr()
Create a TCP socket from the current context.
- Parameters
-
family | Protocol family |
flags | Flags |
- Returns
- The created socket
References context.
◆ release()
void * SSLContext::release |
( |
| ) |
|
|
noexcept |
Release ownership of the current object.
- Warning
- Note: This function is used to address asio::ssl::context not following the who allocates who releases principle. After calling this function, the object will lose control of SSL_CTX. Unless you are very sure of what you are doing, do not use this function. If you only need to obtain SSL_CTX without changing its lifecycle, please use getContext.
- Returns
- Underlying SSL_CTX pointer
References context.
◆ context
void* sese::security::SSLContext::context = nullptr |
|
private |
The documentation for this class was generated from the following files: