Kea 2.7.6
isc::asiolink::TlsContextBase Class Referenceabstract

TLS context base class. More...

#include <common_tls.h>

+ Inheritance diagram for isc::asiolink::TlsContextBase:

Public Member Functions

 TlsContextBase (TlsRole role)
 Create a fresh context.
 
virtual ~TlsContextBase ()
 Destructor.
 
virtual bool getCertRequired () const =0
 Get the peer certificate requirement mode.
 
TlsRole getRole () const
 Returns the role.
 

Static Public Member Functions

static void configure (TlsContextPtr &context, TlsRole role, const std::string &ca_file, const std::string &cert_file, const std::string &key_file, bool cert_required=true)
 Configure.
 

Public Attributes

TlsRole role_
 The role i.e. client or server.
 

Protected Member Functions

virtual void loadCaFile (const std::string &ca_file)=0
 Load the trust anchor aka certification authority.
 
virtual void loadCaPath (const std::string &ca_path)=0
 Load the trust anchor aka certification authority.
 
virtual void loadCertFile (const std::string &cert_file)=0
 Load the certificate file.
 
virtual void loadKeyFile (const std::string &key_file)=0
 Load the private key from a file.
 
virtual void setCertRequired (bool cert_required)=0
 Set the peer certificate requirement mode.
 

Detailed Description

TLS context base class.

Definition at line 40 of file common_tls.h.

Constructor & Destructor Documentation

◆ ~TlsContextBase()

virtual isc::asiolink::TlsContextBase::~TlsContextBase ( )
inlinevirtual

Destructor.

Definition at line 43 of file common_tls.h.

◆ TlsContextBase()

isc::asiolink::TlsContextBase::TlsContextBase ( TlsRole role)
inlineexplicit

Create a fresh context.

Parameters
roleThe TLS role client or server.

Definition at line 48 of file common_tls.h.

Member Function Documentation

◆ configure()

void isc::asiolink::TlsContextBase::configure ( TlsContextPtr & context,
TlsRole role,
const std::string & ca_file,
const std::string & cert_file,
const std::string & key_file,
bool cert_required = true )
static

Configure.

Note
No need for a role set method.
Parameters
contextThe TLS context to configure.
roleThe TLS role client or server.
ca_fileThe certificate file or directory name.
cert_fileThe certificate file name.
key_fileThe private key file name.
cert_requiredTrue if peer certificates are required, false if they are optional. This is a server specific parameter.
Exceptions
isc::BadValueon error.

Definition at line 22 of file common_tls.cc.

References isc_throw, and isc::util::file::isDir().

+ Here is the call graph for this function:

◆ getCertRequired()

virtual bool isc::asiolink::TlsContextBase::getCertRequired ( ) const
pure virtual

Get the peer certificate requirement mode.

Returns
True if peer certificates are required, false if they are optional.

◆ getRole()

TlsRole isc::asiolink::TlsContextBase::getRole ( ) const
inline

Returns the role.

Definition at line 51 of file common_tls.h.

References role_.

◆ loadCaFile()

virtual void isc::asiolink::TlsContextBase::loadCaFile ( const std::string & ca_file)
protectedpure virtual

Load the trust anchor aka certification authority.

Parameters
ca_fileThe certificate file name.
Exceptions
isc::cryptolink::LibraryErroron various errors as file not found, bad format, etc.

◆ loadCaPath()

virtual void isc::asiolink::TlsContextBase::loadCaPath ( const std::string & ca_path)
protectedpure virtual

Load the trust anchor aka certification authority.

Parameters
ca_pathThe certificate directory name.
Exceptions
isc::cryptolink::LibraryErroron various errors as file not found, bad format, etc.

◆ loadCertFile()

virtual void isc::asiolink::TlsContextBase::loadCertFile ( const std::string & cert_file)
protectedpure virtual

Load the certificate file.

Parameters
cert_fileThe certificate file name.
Exceptions
isc::cryptolink::LibraryErroron various errors as file not found, bad format, etc.

◆ loadKeyFile()

virtual void isc::asiolink::TlsContextBase::loadKeyFile ( const std::string & key_file)
protectedpure virtual

Load the private key from a file.

Parameters
key_fileThe private key file name.
Exceptions
isc::cryptolink::LibraryErroron various errors as file not found, bad format, etc.

◆ setCertRequired()

virtual void isc::asiolink::TlsContextBase::setCertRequired ( bool cert_required)
protectedpure virtual

Set the peer certificate requirement mode.

Parameters
cert_requiredTrue if peer certificates are required, false if they are optional.
Exceptions
isc::BadValuewhen cert_required is set to false for a client.

Member Data Documentation

◆ role_

TlsRole isc::asiolink::TlsContextBase::role_

The role i.e. client or server.

Definition at line 118 of file common_tls.h.

Referenced by getRole().


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