sipxportlib  Version 3.3
Public Member Functions | Static Public Member Functions | List of all members
OsSSL Class Reference

Wrapper for the OpenSSL SSL_CTX context structure. This class is responsible for all global policy initialization and enforcement. More...

#include <OsSSL.h>

Public Member Functions

 OsSSL (const char *authorityPath=NULL, const char *publicCertificatePath=NULL, const char *privateKeyPath=NULL)
 Construct an SSL Context from which connections are created. More...
 
 ~OsSSL ()
 
SSL * getServerConnection ()
 Get an SSL server connection handle. More...
 
SSL * getClientConnection ()
 Get an SSL client connection handle. More...
 
void releaseConnection (SSL *&connection)
 Release an SSL session handle. More...
 
void dumpCipherList ()
 Debug: print out list of ciphers enabled. More...
 

Static Public Member Functions

static bool peerIdentity (SSL *connection, UtlSList *altNames, UtlString *commonName)
 Get the validated names for the connection peer. More...
 
static void logConnectParams (const OsSysLogFacility facility, const OsSysLogPriority priority, const char *callerMsg, SSL *connection)
 Log SSL connection information. More...
 
static void logError (const OsSysLogFacility facility, const OsSysLogPriority priority, const char *callerMsg, int errCode)
 Log an error resulting from an SSL call, with the SSL error text expanded. More...
 

Detailed Description

Wrapper for the OpenSSL SSL_CTX context structure. This class is responsible for all global policy initialization and enforcement.

Constructor & Destructor Documentation

OsSSL ( const char *  authorityPath = NULL,
const char *  publicCertificatePath = NULL,
const char *  privateKeyPath = NULL 
)

Construct an SSL Context from which connections are created.

Parameters
authorityPathPath to a directory containing trusted certificates files; If NULL, compiled-in default is used
publicCertificatePathPath to certificate file; If NULL, compiled-in default is used
privateKeyPathPath to private key file; If NULL, compiled-in default is used.
Note
: If publicCertificatePath is NULL, this must also be NULL.
~OsSSL ( )

Member Function Documentation

SSL* getServerConnection ( )

Get an SSL server connection handle.

SSL* getClientConnection ( )

Get an SSL client connection handle.

void releaseConnection ( SSL *&  connection)

Release an SSL session handle.

static bool peerIdentity ( SSL *  connection,
UtlSList altNames,
UtlString commonName 
)
static

Get the validated names for the connection peer.

Usually, the names in the altNames will be easier to parse and use than commonName Either or both of altNames or commonName may be NULL, in which case no names are returned; the return value still indicates the trust relationship with the peer certificate.

Returns
  • true if the connection peer is validated by a trusted authority
  • false if not, in which case no names are returned.
Parameters
connectionSSL context from connection to be described
altNamesUtlStrings for verfied subjectAltNames are added to this - caller must free them.
commonNamethe Subject name is returned here
static void logConnectParams ( const OsSysLogFacility  facility,
const OsSysLogPriority  priority,
const char *  callerMsg,
SSL *  connection 
)
static

Log SSL connection information.

Parameters
facilitycallers facility
prioritylog priority
callerMsgIdentifies circumstances of connection
connectionSSL connection to be described
static void logError ( const OsSysLogFacility  facility,
const OsSysLogPriority  priority,
const char *  callerMsg,
int  errCode 
)
static

Log an error resulting from an SSL call, with the SSL error text expanded.

Parameters
facilitycallers facility
priorityhow bad was it?
callerMsgIdentifies caller and what failed
errCodeerror returned from ssl routine
void dumpCipherList ( )

Debug: print out list of ciphers enabled.