OpenVPN 3 Core Library
Loading...
Searching...
No Matches
openvpn::AccHandshaker Class Reference

defines a class that handles SSL/TLS handshaking More...

#include <acc_certcheck.hpp>

Public Types

using MsgT = std::optional< std::string >
 

Public Member Functions

 AccHandshaker ()=default
 
 AccHandshaker (SSLLib::SSLAPI::Config::Ptr cfg)
 Construct a new AccHandshaker object.
 
MsgT process_msg (const MsgT &msg)
 Incrementally process the CLIENT HELLO / SERVER HELLO exchange.
 
std::string details ()
 returns ssl_handshake_details() if the SSLAPI is available
 
void reset (SSLLib::SSLAPI::Config::Ptr cfg)
 Re-init the handshaker.
 

Private Attributes

std::unique_ptr< SslApiBuildermSslApi
 

Detailed Description

defines a class that handles SSL/TLS handshaking

Defines a class that handles SSL/TLS handshaking for device authentication.

It takes in a configuration pointer for the SSL library and uses that to initialize an SSL connection object. The main methods are the constructor which takes the SSL config pointer and initializes the internal SSL object using that config. The process_msg method takes in a message string, passes it into the SSL object to continue the handshake, and returns any response message the SSL object generates during the handshake. This allows incrementally processing the handshake protocol messages. The reset method reinitializes the SSL object if the config changes.

Internally it contains a unique pointer to a SslApiBuilder object. The SslApiBuilder initializes the lower level SSL objects like the SSL context, factory, and server instance using the provided configuration. So the AccHandshaker gives a simple interface to perform an SSL handshake using an SSL configuration. It handles setting up the SSL objects correctly, feeding the handshake messages into the SSL library, and getting any responses back out. This allows verifying possession of the correct certificates and keys.

Definition at line 86 of file acc_certcheck.hpp.

Member Typedef Documentation

◆ MsgT

using openvpn::AccHandshaker::MsgT = std::optional<std::string>

Definition at line 88 of file acc_certcheck.hpp.

Constructor & Destructor Documentation

◆ AccHandshaker() [1/2]

openvpn::AccHandshaker::AccHandshaker ( )
default

◆ AccHandshaker() [2/2]

openvpn::AccHandshaker::AccHandshaker ( SSLLib::SSLAPI::Config::Ptr  cfg)
inline

Construct a new AccHandshaker object.

Parameters
cfgan initialized confiog object type Config::Ptr

Definition at line 102 of file acc_certcheck.hpp.

Member Function Documentation

◆ details()

std::string openvpn::AccHandshaker::details ( )
inline

returns ssl_handshake_details() if the SSLAPI is available

Returns
std::string containing SSLAPI details
Exceptions
std::exceptionderived type with more information regarding the problem

Definition at line 148 of file acc_certcheck.hpp.

◆ process_msg()

AccHandshaker::MsgT openvpn::AccHandshaker::process_msg ( const MsgT msg)
inline

Incrementally process the CLIENT HELLO / SERVER HELLO exchange.

Parameters
msgoptional cipher text from the TLS peer
Returns
optional<string> reply for the given msg text if any
Exceptions
std::exceptionderived type with more information regarding the problem

The function will stop returning reply data when it's done handshaking. A handshake failure may result in an exception derived from std::exception being thrown.

Definition at line 116 of file acc_certcheck.hpp.

Here is the caller graph for this function:

◆ reset()

void openvpn::AccHandshaker::reset ( SSLLib::SSLAPI::Config::Ptr  cfg)
inline

Re-init the handshaker.

Parameters
cfgconfiguration that should be installed
Exceptions
throwsan object derived from std::exception if there is a problem with the init process

Rebuilds the SSLAPI object with the specified configuration and begins the handshake process. Data exchange for the actual handshake is done via calls to process_msg.

Definition at line 163 of file acc_certcheck.hpp.

Here is the caller graph for this function:

Member Data Documentation

◆ mSslApi

std::unique_ptr<SslApiBuilder> openvpn::AccHandshaker::mSslApi
private

Definition at line 96 of file acc_certcheck.hpp.


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