Logo Search packages:      
Sourcecode: poco version File versions  Download package

Poco::Net::SSLManager Class Reference

#include <SSLManager.h>

List of all members.


Detailed Description

Class SSLManager. Singleton for holding the default server/client Context and PrivateKeyPassphraseHandler. Either initialize via Poco::Util::Application or via the initialize methods of the singleton. Note that the latter initialization must happen very early during program startup before somebody calls defaultClientContext()/defaultServerContext() or any of the passPhraseHandler methods (which tries to auto-initialize the context and passphrase handler based on an Poco::Util::Application configuration). An exemplary documentation which sets either the server or client defaultcontext and creates a PrivateKeyPassphraseHandler that reads the password from the XML file looks like this:

<AppConfig> <openSSL> <server|client> <privateKeyFile>any.pem</privateKeyFile> <caConfig>rootcert.pem</caConfig> <verificationMode>relaxed</verificationMode> <verificationDepth>9</verificationDepth> <loadDefaultCAFile>true</loadDefaultCAFile> <cypherList>ALL:!ADH:!LOW:!EXP:!MD5:</cypherList> <privateKeyPassphraseHandler> <name>KeyFileHandler</name> <options> <password>test</password> </options> </privateKeyPassphraseHandler> <invalidCertificateHandler> <name>ConsoleCertificateHandler</name> <options> </options> </invalidCertificateHandler> </server|client> </openSSL> </AppConfig>

Definition at line 61 of file SSLManager.h.


Public Types

typedef Poco::SharedPtr< ContextContextPtr
typedef Poco::SharedPtr
< InvalidCertificateHandler
InvalidCertificateHandlerPtr
typedef Poco::SharedPtr
< PrivateKeyPassphraseHandler
PrivateKeyPassphraseHandlerPtr

Public Member Functions

CertificateHandlerFactoryMgrcertificateHandlerFactoryMgr ()
InvalidCertificateHandlerPtr clientCertificateHandler ()
PrivateKeyPassphraseHandlerPtr clientPassPhraseHandler ()
ContextPtr defaultClientContext ()
ContextPtr defaultServerContext ()
void initializeClient (PrivateKeyPassphraseHandlerPtr &ptrPassPhraseHandler, InvalidCertificateHandlerPtr &ptrHandler, ContextPtr ptrContext)
void initializeServer (PrivateKeyPassphraseHandlerPtr &ptrPassPhraseHandler, InvalidCertificateHandlerPtr &ptrHandler, ContextPtr ptrContext)
 Returns the instance of the SSLManager singleton.
PrivateKeyFactoryMgrprivateKeyFactoryMgr ()
InvalidCertificateHandlerPtr serverCertificateHandler ()
PrivateKeyPassphraseHandlerPtr serverPassPhraseHandler ()

Static Public Member Functions

static SSLManagerinstance ()
static int privateKeyPasswdCallback (char *pBuf, int size, int flag, void *userData)
static int verifyClientCallback (int ok, X509_STORE_CTX *pStore)
static int verifyServerCallback (int ok, X509_STORE_CTX *pStore)

Public Attributes

Poco::BasicEvent
< VerificationErrorArgs
ClientVerificationError
 Thrown whenever a certificate error is detected by the server during a handshake.
Poco::BasicEvent< std::string > PrivateKeyPassPhrase
 Thrown whenever a certificate error is detected by the client during a handshake.
Poco::BasicEvent
< VerificationErrorArgs
ServerVerificationError

Static Public Attributes

static const std::string CFG_CLIENT_PREFIX
static const std::string CFG_SERVER_PREFIX

Private Member Functions

void initCertificateHandler (bool server)
 Inits the passphrase handler.
void initDefaultContext (bool server)
 Destroys the SSLManager.
void initEvents (bool server)
 Inits the default context, the first time it is accessed.
void initPassPhraseHandler (bool server)
 Registers delegates at the events according to the configuration.
 ~SSLManager ()
 Creates the SSLManager.

Static Private Member Functions

static int verifyCallback (bool server, int ok, X509_STORE_CTX *pStore)
 Inits the certificate handler.

Private Attributes

CertificateHandlerFactoryMgr _certHandlerFactoryMgr
PrivateKeyFactoryMgr _factoryMgr
InvalidCertificateHandlerPtr _ptrClientCertificateHandler
PrivateKeyPassphraseHandlerPtr _ptrClientPassPhraseHandler
ContextPtr _ptrDefaultClientContext
ContextPtr _ptrDefaultServerContext
InvalidCertificateHandlerPtr _ptrServerCertificateHandler
PrivateKeyPassphraseHandlerPtr _ptrServerPassPhraseHandler

Static Private Attributes

static const std::string CFG_CA_LOCATION
static const std::string CFG_CERTIFICATE_HANDLER
static const std::string CFG_CYPHER_LIST
static const std::string CFG_DELEGATE_HANDLER
static const std::string CFG_ENABLE_DEFAULT_CA
static const std::string CFG_PRIV_KEY_FILE
static const std::string CFG_VER_DEPTH
static const std::string CFG_VER_MODE
static const std::string VAL_CERTIFICATE_HANDLER
static const std::string VAL_CYPHER_LIST
static const std::string VAL_DELEGATE_HANDLER
static const bool VAL_ENABLE_DEFAULT_CA
static const int VAL_VER_DEPTH
static const
Context::VerificationMode 
VAL_VER_MODE

Friends

class Poco::SingletonHolder< SSLManager >

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

Generated by  Doxygen 1.6.0   Back to index