#include <TransportTLSCommon.H>
Public Member Functions | |
TransportTLSCommon () | |
Constructor. | |
~TransportTLSCommon () | |
Destructor. | |
void | read (string &xml_payload, const int &timeout=TIMEOUT) |
Read payload from the open connection. | |
void | write (const string &xml_payload, const int &timeout=TIMEOUT) |
Write payload to the open connection. | |
void | disconnect () |
Close the connection. | |
string | get_openssl_msg () const |
Return the OpenSSL error message. | |
long | cert_common_name_check (const string &common_name) |
Checks if peer's certificate common name matches string common_name. | |
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. | |
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. | |
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. |
long TransportTLSCommon::cert_common_name_check | ( | const string & | common_name | ) |
Checks if peer's certificate common name matches string common_name.
common_name | expected common_name |
string TransportTLSCommon::get_openssl_msg | ( | ) | const |
Return the OpenSSL error message.
static int TransportTLSCommon::pem_passwd_cb | ( | char * | buf, | |
int | size, | |||
int | rwflag, | |||
void * | userdata | |||
) | [static, protected] |
Callback method used by OpenSSL to collect passphrases.
buf | buffer that the passphrase should be copied into | |
size | size of buf in bytes, including the NULL terminating character | |
rwflag | indicates whether the callback is used for reading/decryption (rwflag=0) or writing/decryption (rwflag=1) | |
userdata | application specific data |
void TransportTLSCommon::read | ( | string & | xml_payload, | |
const int & | timeout = TIMEOUT | |||
) |
Read payload from the open connection.
xml_payload | buffer to be read | |
timeout | timeout 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.
cert_file | Certificate file | |
root_ca_file | Root certificate file | |
pem_passphrase | Optional passphrase for an encrypted private key |
void TransportTLSCommon::write | ( | const string & | xml_payload, | |
const int & | timeout = TIMEOUT | |||
) |
Write payload to the open connection.
xml_payload | XML Payload | |
timeout | timeout in seconds |