gloox 1.0
|
00001 /* 00002 * Copyright (c) 2007-2009 by Jakob Schroeter <js@camaya.net> 00003 * This file is part of the gloox library. http://camaya.net/gloox 00004 * 00005 * This software is distributed under a license. The full license 00006 * agreement can be found in the file LICENSE in this distribution. 00007 * This software may not be copied, modified, sold or distributed 00008 * other than expressed in the named license agreement. 00009 * 00010 * This software is distributed without any warranty. 00011 */ 00012 00013 00014 #ifndef TLSDEFAULT_H__ 00015 #define TLSDEFAULT_H__ 00016 00017 #include "tlsbase.h" 00018 00019 namespace gloox 00020 { 00021 00022 class TLSHandler; 00023 00033 class GLOOX_API TLSDefault : public TLSBase 00034 { 00035 public: 00036 00040 enum Type 00041 { 00042 VerifyingClient = 1, 00044 AnonymousClient = 2, 00046 VerifyingServer = 4, 00047 AnonymousServer = 8 00049 }; 00050 00057 TLSDefault( TLSHandler* th, const std::string server, Type type = VerifyingClient ); 00058 00062 virtual ~TLSDefault(); 00063 00064 // reimplemented from TLSBase 00065 virtual bool init( const std::string& clientKey = EmptyString, 00066 const std::string& clientCerts = EmptyString, 00067 const StringList& cacerts = StringList() ); 00068 00069 // reimplemented from TLSBase 00070 virtual bool encrypt( const std::string& data ); 00071 00072 // reimplemented from TLSBase 00073 virtual int decrypt( const std::string& data ); 00074 00075 // reimplemented from TLSBase 00076 virtual void cleanup(); 00077 00078 // reimplemented from TLSBase 00079 virtual bool handshake(); 00080 00081 // reimplemented from TLSBase 00082 virtual bool isSecure() const; 00083 00084 // reimplemented from TLSBase 00085 virtual void setCACerts( const StringList& cacerts ); 00086 00087 // reimplemented from TLSBase 00088 virtual const CertInfo& fetchTLSInfo() const; 00089 00090 // reimplemented from TLSBase 00091 virtual void setClientCert( const std::string& clientKey, const std::string& clientCerts ); 00092 00097 static int types(); 00098 00099 private: 00100 TLSBase* m_impl; 00101 00102 }; 00103 } 00104 00105 #endif // TLSDEFAULT_H__