7 #ifndef __TRANSPORTTLSCOMMON_H__
8 #define __TRANSPORTTLSCOMMON_H__
12 #include <openssl/bio.h>
13 #include <openssl/ssl.h>
38 void read(
string &xml_payload,
const int &timeout =
TIMEOUT);
45 void write(
const string &xml_payload,
const int &timeout =
TIMEOUT);
82 static int pem_passwd_cb(
char *buf,
int size,
int rwflag,
void *userdata);
91 const string &root_ca_file,
92 const string &pem_passphrase =
"");
117 #endif //__TRANSPORTTLSCOMMON_H__
string get_openssl_msg() const
Return the OpenSSL error message.
void enable_cert_common_name_check()
Enables peer's certificate common name check.
bool _cert_common_name_check_enabled
Flag for peer's certificate CN check.
Definition: TransportTLSCommon.H:113
void set_non_blocking()
Set the underlying I/O descriptor as non-blocking.
void read(string &xml_payload, const int &timeout=TIMEOUT)
Read payload from the open connection.
static const int TIMEOUT
Default read/write timeout in seconds.
Definition: TransportTLSCommon.H:110
TransportTLSCommon()
Constructor.
void seed_prng()
Seed OpenSSL pseudo random number generator.
long cert_common_name_check(const string &common_name)
Checks if peer's certificate common name matches string common_name.
SSL * _ssl
SSL object.
Definition: TransportTLSCommon.H:104
BIO * _conn
BIO Socket.
Definition: TransportTLSCommon.H:98
TransportTLSCommon class.
Definition: TransportTLSCommon.H:24
String Manipulation Utilities.
void write(const string &xml_payload, const int &timeout=TIMEOUT)
Write payload to the open connection.
void disconnect()
Close the connection.
~TransportTLSCommon()
Destructor.
SSL_CTX * _ssl_ctx
SSL Context.
Definition: TransportTLSCommon.H:101
void setup_context(const string &cert_file, const string &root_ca_file, const string &pem_passphrase="")
Setup Context for Certificate Validation.
static int pem_passwd_cb(char *buf, int size, int rwflag, void *userdata)
Callback method used by OpenSSL to collect passphrases.
static string _pem_passphrase
pem passphrase
Definition: TransportTLSCommon.H:107
void disable_cert_common_name_check()
Disables peer's certificate common name check.