MySQL 8.0.37
Source Code Documentation
TlsClientContext Class Reference

Client TLS Context. More...

#include <tls_client_context.h>

Inheritance diagram for TlsClientContext:
[legend]

Public Member Functions

 TlsClientContext (TlsVerify mode=TlsVerify::PEER)
 
stdx::expected< void, std::error_code > cipher_list (const std::string &ciphers)
 set cipher-list. More...
 
stdx::expected< void, std::error_code > cipher_suites (const std::string &ciphers)
 set cipher-suites of TLSv1.3. More...
 
stdx::expected< void, std::error_code > verify (TlsVerify verify)
 verification of certificates. More...
 
stdx::expected< void, std::error_code > verify_hostname (const std::string &server_host)
 verify hostname. More...
 
- Public Member Functions inherited from TlsContext
 TlsContext (const SSL_METHOD *method)
 construct a TlsContext based on the SSL_METHODs provided by openssl. More...
 
stdx::expected< void, std::error_code > ssl_ca (const std::string &ca_file, const std::string &ca_path)
 set CA file and CA directory. More...
 
stdx::expected< void, std::error_code > crl (const std::string &crl_file, const std::string &crl_path)
 set CRL file and CRL directory. More...
 
SSL_CTX * get () const
 get non-owning pointer to SSL_CTX. More...
 
stdx::expected< void, std::error_code > version_range (TlsVersion min_version, TlsVersion max_version)
 set the supported TLS version range. More...
 
TlsVersion min_version () const
 get the min TLS version. More...
 
stdx::expected< void, std::error_code > curves_list (const std::string &curves)
 init elliptic curves for DH ciphers for Perfect Forward Security. More...
 
std::vector< std::string > cipher_list () const
 get current cipher-list. More...
 
void info_callback (InfoCallback)
 set info callback. More...
 
InfoCallback info_callback () const
 get info callback More...
 
int security_level () const
 get security_level. More...
 
long session_cache_hits () const
 get session reuse cache hits number More...
 

Additional Inherited Members

- Public Types inherited from TlsContext
using InfoCallback = void(*)(const SSL *, int, int)
 
- Static Public Member Functions inherited from TlsContext
static constexpr bool has_set_curves_list ()
 if TLS context allows to change elliptic curves list. More...
 
static constexpr bool has_set_cipher_suites ()
 if TLS context allows setting cipher-suites (TLSv1.3 and later). More...
 
- Protected Attributes inherited from TlsContext
std::unique_ptr< SSL_CTX, decltype(&SSL_CTX_free)> ssl_ctx_
 

Detailed Description

Client TLS Context.

Constructor & Destructor Documentation

◆ TlsClientContext()

TlsClientContext::TlsClientContext ( TlsVerify  mode = TlsVerify::PEER)

Member Function Documentation

◆ cipher_list()

stdx::expected< void, std::error_code > TlsClientContext::cipher_list ( const std::string &  ciphers)

set cipher-list.

for TLSv1.2-and-earlier ciphers.

Parameters
cipherscolon separated list of ciphers
Note
list is not filtered for unacceptable ciphers
See also
openssl ciphers
cipher_suites()

◆ cipher_suites()

stdx::expected< void, std::error_code > TlsClientContext::cipher_suites ( const std::string &  ciphers)

set cipher-suites of TLSv1.3.

openssl 1.1.1 added support for TLSv1.3 and move setting those ciphers to SSL_CTX_set_ciphersuites().

Parameters
cipherscolon separated list of ciphers. empty == empty, "DEFAULT" is the default-set
Note
list is not filtered for unacceptable ciphers
See also
openssl ciphers
has_set_cipher_suites()

◆ verify()

stdx::expected< void, std::error_code > TlsClientContext::verify ( TlsVerify  verify)

verification of certificates.

◆ verify_hostname()

stdx::expected< void, std::error_code > TlsClientContext::verify_hostname ( const std::string &  server_host)

verify hostname.

Parameters
server_hosthostname or ip-address to match in the certificate.

The documentation for this class was generated from the following files: