libepp_nicbr
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
TransportTLSCommon Class Reference

TransportTLSCommon class. More...

#include <TransportTLSCommon.H>

Inheritance diagram for TransportTLSCommon:
TransportTLS

Public Member Functions

 TransportTLSCommon ()
 Constructor.
 
 ~TransportTLSCommon ()
 Destructor.
 
void read (string &xml_payload, const int &timeout=TIMEOUT)
 Read payload from the open connection. More...
 
void write (const string &xml_payload, const int &timeout=TIMEOUT)
 Write payload to the open connection. More...
 
void disconnect ()
 Close the connection.
 
string get_openssl_msg () const
 Return the OpenSSL error message. More...
 
long cert_common_name_check (const string &common_name)
 Checks if peer's certificate common name matches string common_name. More...
 
void enable_cert_common_name_check ()
 Enables peer's certificate common name check.
 
void disable_cert_common_name_check ()
 Disables peer's certificate common name check.
 

Protected Member Functions

void seed_prng ()
 Seed OpenSSL pseudo random number generator.
 
void setup_context (const string &cert_file, const string &root_ca_file, const string &pem_passphrase="")
 Setup Context for Certificate Validation. More...
 
void set_non_blocking ()
 Set the underlying I/O descriptor as non-blocking.
 

Static Protected Member Functions

static int pem_passwd_cb (char *buf, int size, int rwflag, void *userdata)
 Callback method used by OpenSSL to collect passphrases. More...
 

Protected Attributes

BIO * _conn
 BIO Socket.
 
SSL_CTX * _ssl_ctx
 SSL Context.
 
SSL * _ssl
 SSL object.
 
bool _cert_common_name_check_enabled
 Flag for peer's certificate CN check.
 

Static Protected Attributes

static string _pem_passphrase
 pem passphrase
 
static const int TIMEOUT
 Default read/write timeout in seconds.
 

Detailed Description

TransportTLSCommon class.

Member Function Documentation

long TransportTLSCommon::cert_common_name_check ( const string &  common_name)

Checks if peer's certificate common name matches string common_name.

Parameters
common_nameexpected common_name
Returns
X509 error code
string TransportTLSCommon::get_openssl_msg ( ) const

Return the OpenSSL error message.

Returns
OpenSSL error message
static int TransportTLSCommon::pem_passwd_cb ( char *  buf,
int  size,
int  rwflag,
void *  userdata 
)
staticprotected

Callback method used by OpenSSL to collect passphrases.

Parameters
bufbuffer that the passphrase should be copied into
sizesize of buf in bytes, including the NULL terminating character
rwflagindicates whether the callback is used for reading/decryption (rwflag=0) or writing/decryption (rwflag=1)
userdataapplication specific data
Returns
the actual length of the password
void TransportTLSCommon::read ( string &  xml_payload,
const int &  timeout = TIMEOUT 
)

Read payload from the open connection.

Parameters
xml_payloadbuffer to be read
timeouttimeout in seconds
void TransportTLSCommon::setup_context ( const string &  cert_file,
const string &  root_ca_file,
const string &  pem_passphrase = "" 
)
protected

Setup Context for Certificate Validation.

Parameters
cert_fileCertificate file
root_ca_fileRoot certificate file
pem_passphraseOptional passphrase for an encrypted private key
void TransportTLSCommon::write ( const string &  xml_payload,
const int &  timeout = TIMEOUT 
)

Write payload to the open connection.

Parameters
xml_payloadXML Payload
timeouttimeout in seconds

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