00001 // -*- C++ -*- 00002 // 00003 // $Id: HTTPS_Context.inl 91118 2010-07-17 10:29:57Z mcorino $ 00004 00005 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00006 00007 namespace ACE 00008 { 00009 namespace HTTPS 00010 { 00011 00012 ACE_INLINE 00013 Context::operator bool (void) const 00014 { 00015 return this->ssl_ctx_ != 0; 00016 } 00017 00018 ACE_INLINE 00019 bool Context::operator ! (void) const 00020 { 00021 return this->ssl_ctx_ == 0; 00022 } 00023 00024 ACE_INLINE 00025 ACE_SSL_Context& Context::ssl_context (void) 00026 { 00027 return *this->ssl_ctx_; 00028 } 00029 00030 ACE_INLINE 00031 const ACE_SSL_Context& Context::ssl_context (void) const 00032 { 00033 return *this->ssl_ctx_; 00034 } 00035 00036 ACE_INLINE 00037 bool Context::use_default_ca () 00038 { 00039 if (::SSL_CTX_set_default_verify_paths(this->ssl_ctx_->context ()) != 1) 00040 { 00041 ACE_SSL_Context::report_error (); 00042 return false; 00043 } 00044 return true; 00045 } 00046 00047 ACE_INLINE 00048 bool Context::set_key_files (const char* certificate_filename, 00049 const char* private_key_filename, 00050 int file_type) 00051 { 00052 if (this->ssl_ctx_->certificate (certificate_filename, file_type) == 0) 00053 { 00054 if (this->ssl_ctx_->private_key (private_key_filename, file_type) == 0) 00055 { 00056 return true; 00057 } 00058 } 00059 return false; 00060 } 00061 00062 ACE_INLINE 00063 int Context::has_trusted_ca () 00064 { 00065 return this->ssl_ctx_->have_trusted_ca (); 00066 } 00067 00068 ACE_INLINE 00069 void Context::set_default_ssl_mode (int ssl_mode) 00070 { 00071 Context::ssl_mode_ = ssl_mode; 00072 } 00073 00074 ACE_INLINE 00075 void Context::set_default_verify_mode (bool verify_peer) 00076 { 00077 Context::ssl_verify_peer_ = verify_peer; 00078 } 00079 00080 ACE_INLINE 00081 void Context::set_default_verify_settings (bool strict, 00082 bool once, 00083 int depth) 00084 { 00085 Context::ssl_strict_ = strict; 00086 Context::ssl_once_ = once; 00087 Context::ssl_depth_ = depth; 00088 } 00089 00090 00091 } 00092 } 00093 00094 ACE_END_VERSIONED_NAMESPACE_DECL