Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef ACE_HTTPS_CONTEXT_H
00010 #define ACE_HTTPS_CONTEXT_H
00011
00012 #include "ace/pre.h"
00013
00014 #include "ace/SString.h"
00015 #include "ace/Auto_Ptr.h"
00016 #include "ace/Singleton.h"
00017 #include "ace/SSL/SSL_Context.h"
00018 #include "ace/INet/SSL_CallbackManager.h"
00019
00020 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00021
00022 namespace ACE
00023 {
00024 namespace HTTPS
00025 {
00026
00027
00028
00029
00030
00031
00032 class ACE_INET_Export Context
00033 {
00034 public:
00035 Context (bool verify_peer = Context::ssl_verify_peer_,
00036 bool strict = Context::ssl_strict_,
00037 bool once = Context::ssl_once_,
00038 int depth = Context::ssl_depth_,
00039 int ssl_mode = Context::ssl_mode_,
00040 ACE_SSL_Context* ssl_ctx =
00041 ACE_SSL_Context::instance (),
00042 bool release = false,
00043 ACE::INet::SSL_CallbackManager* ssl_cbmngr =
00044 ACE::INet::SSL_CallbackManager::instance ());
00045
00046 Context (ACE_SSL_Context* ssl_ctx,
00047 bool release = false,
00048 ACE::INet::SSL_CallbackManager* ssl_cbmngr = 0);
00049
00050 ~Context ();
00051
00052 operator bool (void) const;
00053
00054 bool operator ! (void) const;
00055
00056 ACE_SSL_Context& ssl_context (void);
00057
00058 const ACE_SSL_Context& ssl_context (void) const;
00059
00060 bool use_default_ca ();
00061
00062 bool set_key_files (const char* certificate_filename,
00063 const char* private_key_filename,
00064 int file_type = SSL_FILETYPE_PEM);
00065
00066 bool load_trusted_ca (const char* ca_location);
00067
00068 int has_trusted_ca ();
00069
00070 static void set_default_ssl_mode (int ssl_mode);
00071
00072 static void set_default_verify_mode (bool verify_peer);
00073
00074 static void set_default_verify_settings (bool strict,
00075 bool once = true,
00076 int depth = 0);
00077
00078 static Context& instance ();
00079
00080 private:
00081 friend class ACE_Singleton<Context, ACE_SYNCH::MUTEX>;
00082
00083
00084 Context (const Context&);
00085
00086 ACE_SSL_Context* ssl_ctx_;
00087 ACE_Auto_Ptr<ACE_SSL_Context> alloc_safe;
00088
00089 static int ssl_mode_;
00090 static bool ssl_strict_;
00091 static bool ssl_once_;
00092 static int ssl_depth_;
00093 static bool ssl_verify_peer_;
00094 };
00095 }
00096 }
00097
00098 ACE_END_VERSIONED_NAMESPACE_DECL
00099
00100 #if defined (__ACE_INLINE__)
00101 #include "ace/INet/HTTPS_Context.inl"
00102 #endif
00103
00104 #include "ace/post.h"
00105 #endif