#include <SSL_CallbackManager.h>
Definition at line 24 of file SSL_CallbackManager.h.
typedef ACE_Refcounted_Auto_Ptr<ACE::INet::SSL_CertificateCallback, ACE_SYNCH::MUTEX> ACE::INet::SSL_CallbackManager::TCertificateCallback [private] |
Definition at line 46 of file SSL_CallbackManager.h.
typedef ACE_Refcounted_Auto_Ptr<ACE::INet::SSL_PasswordCallback, ACE_SYNCH::MUTEX> ACE::INet::SSL_CallbackManager::TPasswordCallback [private] |
Definition at line 48 of file SSL_CallbackManager.h.
ACE::INet::SSL_CallbackManager::SSL_CallbackManager | ( | ) |
Definition at line 24 of file SSL_CallbackManager.cpp.
{ }
ACE::INet::SSL_CallbackManager::~SSL_CallbackManager | ( | ) |
Definition at line 28 of file SSL_CallbackManager.cpp.
{ }
const ACE_SSL_Context * ACE::INet::SSL_CallbackManager::context | ( | void | ) | const [inline] |
Definition at line 13 of file SSL_CallbackManager.inl.
{ return this->ssl_ctx_; }
void ACE::INet::SSL_CallbackManager::initialize_callbacks | ( | ACE_SSL_Context * | ssl_ctx = ACE_SSL_Context::instance () |
) |
Definition at line 32 of file SSL_CallbackManager.cpp.
{ if (ssl_ctx_mngr_index_ < -1) { ssl_ctx_mngr_index_ = ::SSL_CTX_get_ex_new_index (0, 0, 0,0,0); if (ssl_ctx_mngr_index_ < 0) { INET_ERROR (1, (LM_ERROR, DLINFO ACE_TEXT ("SSL_CallbackManager::initialize_callbacks - ") ACE_TEXT ("failed to allocate SSL_CTX ex_data index.\n"))); return; } } this->ssl_ctx_ = ssl_ctx == 0 ? ACE_SSL_Context::instance () : ssl_ctx; ::SSL_CTX_set_ex_data (this->ssl_ctx_->context (), ssl_ctx_mngr_index_, this); this->ssl_ctx_->default_verify_callback (verify_certificate_callback); ::SSL_CTX_set_default_passwd_cb (ssl_ctx->context(), passwd_callback); ::SSL_CTX_set_default_passwd_cb_userdata (ssl_ctx->context(), this); }
SSL_CallbackManager * ACE::INet::SSL_CallbackManager::instance | ( | void | ) | [static] |
Definition at line 53 of file SSL_CallbackManager.cpp.
int ACE::INet::SSL_CallbackManager::passwd_callback | ( | char * | buf, | |
int | size, | |||
int | rwflag, | |||
void * | user_data | |||
) | [static, private] |
Definition at line 97 of file SSL_CallbackManager.cpp.
{ if (user_data == 0) return 0; SSL_CallbackManager* cbmngr = reinterpret_cast<SSL_CallbackManager*> (user_data); ACE_CString pwd; cbmngr->passwd_callback (pwd); if (!pwd.empty ()) { ACE_OS::strncpy (buf, pwd.c_str (), size); buf[size - 1] = '\0'; if (size > ACE_Utils::truncate_cast<int> (pwd.length ())) size = ACE_Utils::truncate_cast<int> (pwd.length ()); return size; } else return 0; }
void ACE::INet::SSL_CallbackManager::passwd_callback | ( | ACE_CString & | pwd | ) | [private] |
Definition at line 68 of file SSL_CallbackManager.cpp.
{ TPasswordCallback pw_cb = passwd_callback_; if (pw_cb) { pw_cb->get_privatekey_password (pwd); } }
void ACE::INet::SSL_CallbackManager::set_certificate_callback | ( | ACE::INet::SSL_CertificateCallback * | cb | ) | [inline] |
Definition at line 19 of file SSL_CallbackManager.inl.
{ this->cert_callback_.reset (cb); }
void ACE::INet::SSL_CallbackManager::set_password_callback | ( | ACE::INet::SSL_PasswordCallback * | cb | ) | [inline] |
Definition at line 25 of file SSL_CallbackManager.inl.
{ this->passwd_callback_.reset (cb); }
int ACE::INet::SSL_CallbackManager::verify_certificate_callback | ( | SSL_CertificateCallbackArg & | arg | ) | [private] |
Definition at line 58 of file SSL_CallbackManager.cpp.
{ TCertificateCallback cert_cb = this->cert_callback_; if (cert_cb) { cert_cb->handle_certificate_failure (arg); } return (arg.ignore_error () ? 1 : 0); }
int ACE::INet::SSL_CallbackManager::verify_certificate_callback | ( | int | ok, | |
X509_STORE_CTX * | cert_ctx | |||
) | [static, private] |
Definition at line 77 of file SSL_CallbackManager.cpp.
{ if (!ok && ssl_ctx_mngr_index_>=0) { // Retrieve the pointer to the SSL of the connection currently treated void* ex_data = ::X509_STORE_CTX_get_ex_data (cert_ctx, ::SSL_get_ex_data_X509_STORE_CTX_idx()); ::SSL* ssl = reinterpret_cast< ::SSL* > (ex_data); // Retrieve SSL_CTX pointer of the connection currently treated ::SSL_CTX* ssl_ctx = ::SSL_get_SSL_CTX (ssl); // Retrieve our SSL_CallbackManager ex_data = ::SSL_CTX_get_ex_data (ssl_ctx, ssl_ctx_mngr_index_); SSL_CallbackManager* cbmngr = reinterpret_cast<SSL_CallbackManager*> (ex_data); SSL_CertificateCallbackArg arg (cbmngr->context(), cert_ctx); ok = cbmngr->verify_certificate_callback (arg); } return ok; }
Definition at line 50 of file SSL_CallbackManager.h.
Definition at line 51 of file SSL_CallbackManager.h.
Definition at line 43 of file SSL_CallbackManager.h.
int ACE::INet::SSL_CallbackManager::ssl_ctx_mngr_index_ = (-2) [static, private] |
Definition at line 56 of file SSL_CallbackManager.h.