version 1.36, 2008/12/02 09:00:52
|
version 1.42, 2013/08/06 08:37:37
|
|
|
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
#ifdef PEGASUS_HAS_SSL |
struct FreeX509STOREPtr | struct FreeX509STOREPtr |
{ | { |
void operator()(X509_STORE* ptr) | void operator()(X509_STORE* ptr) |
{ | { |
#ifdef PEGASUS_HAS_SSL |
|
X509_STORE_free(ptr); | X509_STORE_free(ptr); |
#endif |
|
} | } |
}; | }; |
|
#else |
|
struct FreeX509STOREPtr |
|
{ |
|
void operator()(X509_STORE*) |
|
{ |
|
} |
|
}; |
|
#endif |
|
|
| |
#ifdef PEGASUS_HAS_SSL | #ifdef PEGASUS_HAS_SSL |
| |
|
|
"In ~SSLEnvironmentInitializer(), _instanceCount is %d", | "In ~SSLEnvironmentInitializer(), _instanceCount is %d", |
_instanceCount)); | _instanceCount)); |
| |
|
|
if (_instanceCount == 0) | if (_instanceCount == 0) |
{ | { |
|
EVP_cleanup(); |
|
CRYPTO_cleanup_all_ex_data(); |
ERR_free_strings(); | ERR_free_strings(); |
_uninitializeCallbacks(); | _uninitializeCallbacks(); |
} | } |
|
ERR_remove_state(0); |
} | } |
| |
private: | private: |
|
|
| |
_sslLocks.reset(new Mutex[CRYPTO_num_locks()]); | _sslLocks.reset(new Mutex[CRYPTO_num_locks()]); |
| |
# if defined(PEGASUS_HAVE_PTHREADS) && !defined(PEGASUS_OS_VMS) |
#ifdef PEGASUS_HAVE_PTHREADS |
// Set the ID callback. The ID callback returns a thread ID. | // Set the ID callback. The ID callback returns a thread ID. |
|
# ifdef PEGASUS_OS_VMS |
|
CRYPTO_set_id_callback((CRYPTO_SET_ID_CALLBACK) _getThreadId); |
|
# else |
CRYPTO_set_id_callback((CRYPTO_SET_ID_CALLBACK) pthread_self); | CRYPTO_set_id_callback((CRYPTO_SET_ID_CALLBACK) pthread_self); |
# endif | # endif |
|
#endif |
| |
// Set the locking callback. | // Set the locking callback. |
| |
|
|
(CRYPTO_SET_LOCKING_CALLBACK) _lockingCallback); | (CRYPTO_SET_LOCKING_CALLBACK) _lockingCallback); |
} | } |
| |
|
#if defined(PEGASUS_OS_VMS) && defined(PEGASUS_HAVE_PTHREADS) |
|
static unsigned long _getThreadId(void) |
|
{ |
|
return pthread_getsequence_np(pthread_self()); |
|
} |
|
#endif |
/* | /* |
Reset the SSL locking and ID callbacks. | Reset the SSL locking and ID callbacks. |
*/ | */ |
|
|
static void _lockingCallback( | static void _lockingCallback( |
int mode, | int mode, |
int type, | int type, |
const char* file, |
const char*, |
int line) |
int) |
{ | { |
if (mode & CRYPTO_LOCK) | if (mode & CRYPTO_LOCK) |
{ | { |
|
|
friend class SSLCallbackInfo; | friend class SSLCallbackInfo; |
}; | }; |
| |
class SSLContextRep |
class PEGASUS_COMMON_LINKAGE SSLContextRep |
{ | { |
public: | public: |
| |
|
|
const String& keyPath = String::EMPTY, | const String& keyPath = String::EMPTY, |
const String& crlPath = String::EMPTY, | const String& crlPath = String::EMPTY, |
SSLCertificateVerifyFunction* verifyCert = NULL, | SSLCertificateVerifyFunction* verifyCert = NULL, |
const String& randomFile = String::EMPTY); |
const String& randomFile = String::EMPTY, |
|
const String& cipherSuite = String::EMPTY, |
|
const Boolean& sslCompatibility = false); |
| |
SSLContextRep(const SSLContextRep& sslContextRep); | SSLContextRep(const SSLContextRep& sslContextRep); |
| |
|
|
| |
String getKeyPath() const; | String getKeyPath() const; |
| |
|
String getCipherSuite() const; |
|
|
#ifdef PEGASUS_USE_DEPRECATED_INTERFACES | #ifdef PEGASUS_USE_DEPRECATED_INTERFACES |
String getTrustStoreUserName() const; | String getTrustStoreUserName() const; |
#endif | #endif |
|
|
String _keyPath; | String _keyPath; |
String _crlPath; | String _crlPath; |
String _randomFile; | String _randomFile; |
|
String _cipherSuite; |
|
Boolean _sslCompatibility; |
SSL_CTX * _sslContext; | SSL_CTX * _sslContext; |
| |
Boolean _verifyPeer; | Boolean _verifyPeer; |