Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
cSslConfig Class Reference

#include <SslConfig.h>

Public Types

using cDebugCallback = void(*)(void *, int, const char *, int, const char *)
 Type of the SSL debug callback. More...
 
using cVerifyCallback = int(*)(void *, mbedtls_x509_crt *, int, uint32_t *)
 Type of the SSL certificate verify callback. More...
 

Public Member Functions

 cSslConfig ()
 
int InitDefaults (bool a_IsClient)
 Initialize with mbedTLS default settings. More...
 
void SetAuthMode (eSslAuthMode a_AuthMode)
 Set the authorization mode. More...
 
void SetCACerts (cX509CertPtr a_CACert)
 Set the trusted certificate authority chain. More...
 
void SetCipherSuites (std::vector< int > a_CipherSuites)
 Set the enabled cipher suites. More...
 
void SetDebugCallback (cDebugCallback a_CallbackFun, void *a_CallbackData)
 Set the debug callback. More...
 
void SetOwnCert (cX509CertPtr a_OwnCert, cCryptoKeyPtr a_OwnCertPrivKey)
 Set the certificate to use for connections. More...
 
void SetRng (cCtrDrbgContextPtr a_CtrDrbg)
 Set the random number generator. More...
 
void SetVerifyCallback (cVerifyCallback a_CallbackFun, void *a_CallbackData)
 Set the certificate verify callback. More...
 
 ~cSslConfig ()
 

Static Public Member Functions

static std::shared_ptr< const cSslConfigGetDefaultClientConfig ()
 Returns the default config for client connections. More...
 
static std::shared_ptr< const cSslConfigGetDefaultServerConfig ()
 Returns the default config for server connections. More...
 
static std::shared_ptr< cSslConfigMakeDefaultConfig (bool a_IsClient)
 Creates a new config with some sensible defaults on top of mbedTLS basic settings. More...
 

Private Member Functions

const mbedtls_ssl_config * GetInternal () const
 Returns a pointer to the wrapped mbedtls representation. More...
 

Private Attributes

cX509CertPtr m_CACerts
 
std::vector< int > m_CipherSuites
 
mbedtls_ssl_config m_Config
 
cCtrDrbgContextPtr m_CtrDrbg
 
cX509CertPtr m_OwnCert
 
cCryptoKeyPtr m_OwnCertPrivKey
 

Friends

class cSslContext
 

Detailed Description

Definition at line 25 of file SslConfig.h.

Member Typedef Documentation

◆ cDebugCallback

using cSslConfig::cDebugCallback = void(*)(void *, int, const char *, int, const char *)

Type of the SSL debug callback.

Parameters are: void * Opaque context for the callback int Debug level const char * File name int Line number const char * Message

Definition at line 36 of file SslConfig.h.

◆ cVerifyCallback

using cSslConfig::cVerifyCallback = int(*)(void *, mbedtls_x509_crt *, int, uint32_t *)

Type of the SSL certificate verify callback.

Parameters are: void * Opaque context for the callback mbedtls_x509_crt * Current cert int Cert chain depth uint32_t * Verification flags

Definition at line 44 of file SslConfig.h.

Constructor & Destructor Documentation

◆ cSslConfig()

cSslConfig::cSslConfig ( )

Definition at line 106 of file SslConfig.cpp.

◆ ~cSslConfig()

cSslConfig::~cSslConfig ( )

Definition at line 115 of file SslConfig.cpp.

Member Function Documentation

◆ GetDefaultClientConfig()

std::shared_ptr< const cSslConfig > cSslConfig::GetDefaultClientConfig ( )
static

Returns the default config for client connections.

Definition at line 267 of file SslConfig.cpp.

◆ GetDefaultServerConfig()

std::shared_ptr< const cSslConfig > cSslConfig::GetDefaultServerConfig ( )
static

Returns the default config for server connections.

Definition at line 277 of file SslConfig.cpp.

◆ GetInternal()

const mbedtls_ssl_config* cSslConfig::GetInternal ( ) const
inlineprivate

Returns a pointer to the wrapped mbedtls representation.

Definition at line 85 of file SslConfig.h.

◆ InitDefaults()

int cSslConfig::InitDefaults ( bool  a_IsClient)

Initialize with mbedTLS default settings.

Definition at line 124 of file SslConfig.cpp.

◆ MakeDefaultConfig()

std::shared_ptr< cSslConfig > cSslConfig::MakeDefaultConfig ( bool  a_IsClient)
static

Creates a new config with some sensible defaults on top of mbedTLS basic settings.

Definition at line 226 of file SslConfig.cpp.

◆ SetAuthMode()

void cSslConfig::SetAuthMode ( eSslAuthMode  a_AuthMode)

Set the authorization mode.

Definition at line 138 of file SslConfig.cpp.

◆ SetCACerts()

void cSslConfig::SetCACerts ( cX509CertPtr  a_CACert)

Set the trusted certificate authority chain.

Definition at line 216 of file SslConfig.cpp.

◆ SetCipherSuites()

void cSslConfig::SetCipherSuites ( std::vector< int >  a_CipherSuites)

Set the enabled cipher suites.

Definition at line 205 of file SslConfig.cpp.

◆ SetDebugCallback()

void cSslConfig::SetDebugCallback ( cDebugCallback  a_CallbackFun,
void *  a_CallbackData 
)

Set the debug callback.

Definition at line 170 of file SslConfig.cpp.

◆ SetOwnCert()

void cSslConfig::SetOwnCert ( cX509CertPtr  a_OwnCert,
cCryptoKeyPtr  a_OwnCertPrivKey 
)

Set the certificate to use for connections.

Definition at line 179 of file SslConfig.cpp.

◆ SetRng()

void cSslConfig::SetRng ( cCtrDrbgContextPtr  a_CtrDrbg)

Set the random number generator.

Definition at line 159 of file SslConfig.cpp.

◆ SetVerifyCallback()

void cSslConfig::SetVerifyCallback ( cVerifyCallback  a_CallbackFun,
void *  a_CallbackData 
)

Set the certificate verify callback.

Definition at line 196 of file SslConfig.cpp.

Friends And Related Function Documentation

◆ cSslContext

friend class cSslContext
friend

Definition at line 27 of file SslConfig.h.

Member Data Documentation

◆ m_CACerts

cX509CertPtr cSslConfig::m_CACerts
private

Definition at line 91 of file SslConfig.h.

◆ m_CipherSuites

std::vector<int> cSslConfig::m_CipherSuites
private

Definition at line 92 of file SslConfig.h.

◆ m_Config

mbedtls_ssl_config cSslConfig::m_Config
private

Definition at line 87 of file SslConfig.h.

◆ m_CtrDrbg

cCtrDrbgContextPtr cSslConfig::m_CtrDrbg
private

Definition at line 88 of file SslConfig.h.

◆ m_OwnCert

cX509CertPtr cSslConfig::m_OwnCert
private

Definition at line 89 of file SslConfig.h.

◆ m_OwnCertPrivKey

cCryptoKeyPtr cSslConfig::m_OwnCertPrivKey
private

Definition at line 90 of file SslConfig.h.


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