#include <HTTPS_Context.h>
Public Member Functions | |
Context (bool verify_peer=Context::ssl_verify_peer_, bool strict=Context::ssl_strict_, bool once=Context::ssl_once_, int depth=Context::ssl_depth_, int ssl_mode=Context::ssl_mode_, ACE_SSL_Context *ssl_ctx=ACE_SSL_Context::instance(), bool release=false, ACE::INet::SSL_CallbackManager *ssl_cbmngr=ACE::INet::SSL_CallbackManager::instance()) | |
Context (ACE_SSL_Context *ssl_ctx, bool release=false, ACE::INet::SSL_CallbackManager *ssl_cbmngr=0) | |
~Context () | |
operator bool (void) const | |
bool | operator! (void) const |
ACE_SSL_Context & | ssl_context (void) |
const ACE_SSL_Context & | ssl_context (void) const |
bool | use_default_ca () |
bool | set_key_files (const char *certificate_filename, const char *private_key_filename, int file_type=SSL_FILETYPE_PEM) |
bool | load_trusted_ca (const char *ca_location) |
int | has_trusted_ca () |
Static Public Member Functions | |
static void | set_default_ssl_mode (int ssl_mode) |
static void | set_default_verify_mode (bool verify_peer) |
static void | set_default_verify_settings (bool strict, bool once=true, int depth=0) |
static Context & | instance () |
Private Member Functions | |
Context (const Context &) | |
Private Attributes | |
ACE_SSL_Context * | ssl_ctx_ |
ACE_Auto_Ptr< ACE_SSL_Context > | alloc_safe |
Static Private Attributes | |
static int | ssl_mode_ = ACE_SSL_Context::SSLv3 |
static bool | ssl_strict_ = false |
static bool | ssl_once_ = true |
static int | ssl_depth_ = 0 |
static bool | ssl_verify_peer_ = true |
Friends | |
class | ACE_Singleton< Context, ACE_SYNCH::MUTEX > |
Definition at line 25 of file HTTPS_Context.h.
ACE::HTTPS::Context::Context | ( | bool | verify_peer = Context::ssl_verify_peer_ , |
|
bool | strict = Context::ssl_strict_ , |
|||
bool | once = Context::ssl_once_ , |
|||
int | depth = Context::ssl_depth_ , |
|||
int | ssl_mode = Context::ssl_mode_ , |
|||
ACE_SSL_Context * | ssl_ctx = ACE_SSL_Context::instance () , |
|||
bool | release = false , |
|||
ACE::INet::SSL_CallbackManager * | ssl_cbmngr = ACE::INet::SSL_CallbackManager::instance () | |||
) |
Definition at line 20 of file HTTPS_Context.cpp.
: ssl_ctx_ (0) { if (ssl_ctx == 0) { ACE_NEW_NORETURN (ssl_ctx, ACE_SSL_Context ()); release = true; } if (ssl_ctx != 0) { if (release) { this->alloc_safe.reset (ssl_ctx); } this->ssl_ctx_ = ssl_ctx; this->ssl_ctx_->set_mode (ssl_mode); if (verify_peer) this->ssl_ctx_->set_verify_peer (strict ? 1 : 0, once ? 1 : 0, depth); if (ssl_cbmngr != 0) ssl_cbmngr->initialize_callbacks (this->ssl_ctx_); // do this to be sure that these settings have been properly set // ACE_SSL_Context does not handle this quite correctly ::SSL_CTX_set_verify (this->ssl_ctx_->context (), this->ssl_ctx_->default_verify_mode (), this->ssl_ctx_->default_verify_callback ()); INET_DEBUG (9,(LM_INFO, DLINFO ACE_TEXT ("HTTPS_Context::ctor - ") ACE_TEXT ("ssl_mode = [%d], ")
ACE::HTTPS::Context::Context | ( | ACE_SSL_Context * | ssl_ctx, | |
bool | release = false , |
|||
ACE::INet::SSL_CallbackManager * | ssl_cbmngr = 0 | |||
) |
Definition at line 66 of file HTTPS_Context.cpp.
: 0), this->ssl_ctx_->default_verify_mode ())); } } Context::Context (ACE_SSL_Context* ssl_ctx, bool release, ACE::INet::SSL_CallbackManager* ssl_cbmngr) : ssl_ctx_ (ssl_ctx) { if (this->ssl_ctx_ != 0) {
ACE::HTTPS::Context::~Context | ( | ) |
Definition at line 90 of file HTTPS_Context.cpp.
ACE::HTTPS::Context::Context | ( | const Context & | ) | [private] |
Definition at line 86 of file HTTPS_Context.cpp.
{
int ACE::HTTPS::Context::has_trusted_ca | ( | ) | [inline] |
Definition at line 63 of file HTTPS_Context.inl.
{ return this->ssl_ctx_->have_trusted_ca (); }
Context & ACE::HTTPS::Context::instance | ( | void | ) | [static] |
Definition at line 81 of file HTTPS_Context.cpp.
bool ACE::HTTPS::Context::load_trusted_ca | ( | const char * | ca_location | ) |
Definition at line 94 of file HTTPS_Context.cpp.
{ } Context::~Context () { } bool Context::load_trusted_ca (const char* ca_location) { ACE_stat stat; if (ca_location != 0 && ACE_OS::stat (ca_location, &stat) == 0) { bool is_dir = ((stat.st_mode & S_IFMT) == S_IFDIR); if (this->ssl_ctx_->load_trusted_ca (is_dir ? 0 : ca_location, is_dir ? ca_location : 0, false) == 0) return true; } else {
ACE::HTTPS::Context::operator bool | ( | void | ) | const [inline] |
Definition at line 13 of file HTTPS_Context.inl.
{ return this->ssl_ctx_ != 0; }
bool ACE::HTTPS::Context::operator! | ( | void | ) | const [inline] |
Definition at line 19 of file HTTPS_Context.inl.
{ return this->ssl_ctx_ == 0; }
void ACE::HTTPS::Context::set_default_ssl_mode | ( | int | ssl_mode | ) | [inline, static] |
Definition at line 69 of file HTTPS_Context.inl.
{ Context::ssl_mode_ = ssl_mode; }
void ACE::HTTPS::Context::set_default_verify_mode | ( | bool | verify_peer | ) | [inline, static] |
Definition at line 75 of file HTTPS_Context.inl.
{ Context::ssl_verify_peer_ = verify_peer; }
void ACE::HTTPS::Context::set_default_verify_settings | ( | bool | strict, | |
bool | once = true , |
|||
int | depth = 0 | |||
) | [inline, static] |
Definition at line 81 of file HTTPS_Context.inl.
{ Context::ssl_strict_ = strict; Context::ssl_once_ = once; Context::ssl_depth_ = depth; }
bool ACE::HTTPS::Context::set_key_files | ( | const char * | certificate_filename, | |
const char * | private_key_filename, | |||
int | file_type = SSL_FILETYPE_PEM | |||
) | [inline] |
Definition at line 48 of file HTTPS_Context.inl.
{ if (this->ssl_ctx_->certificate (certificate_filename, file_type) == 0) { if (this->ssl_ctx_->private_key (private_key_filename, file_type) == 0) { return true; } } return false; }
ACE_SSL_Context & ACE::HTTPS::Context::ssl_context | ( | void | ) | [inline] |
Definition at line 25 of file HTTPS_Context.inl.
{ return *this->ssl_ctx_; }
const ACE_SSL_Context & ACE::HTTPS::Context::ssl_context | ( | void | ) | const [inline] |
Definition at line 31 of file HTTPS_Context.inl.
{ return *this->ssl_ctx_; }
bool ACE::HTTPS::Context::use_default_ca | ( | ) | [inline] |
Definition at line 37 of file HTTPS_Context.inl.
{ if (::SSL_CTX_set_default_verify_paths(this->ssl_ctx_->context ()) != 1) { ACE_SSL_Context::report_error (); return false; } return true; }
friend class ACE_Singleton< Context, ACE_SYNCH::MUTEX > [friend] |
Definition at line 74 of file HTTPS_Context.h.
Definition at line 80 of file HTTPS_Context.h.
ACE_SSL_Context* ACE::HTTPS::Context::ssl_ctx_ [private] |
Definition at line 79 of file HTTPS_Context.h.
int ACE::HTTPS::Context::ssl_depth_ = 0 [static, private] |
Definition at line 85 of file HTTPS_Context.h.
int ACE::HTTPS::Context::ssl_mode_ = ACE_SSL_Context::SSLv3 [static, private] |
Definition at line 82 of file HTTPS_Context.h.
bool ACE::HTTPS::Context::ssl_once_ = true [static, private] |
Definition at line 84 of file HTTPS_Context.h.
bool ACE::HTTPS::Context::ssl_strict_ = false [static, private] |
Definition at line 83 of file HTTPS_Context.h.
bool ACE::HTTPS::Context::ssl_verify_peer_ = true [static, private] |
Definition at line 86 of file HTTPS_Context.h.