00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef TLSBASE_H__
00016 #define TLSBASE_H__
00017
00018 #include "gloox.h"
00019 #include "tlshandler.h"
00020
00021 namespace gloox
00022 {
00023
00030 class GLOOX_API TLSBase
00031 {
00032 public:
00038 TLSBase( TLSHandler *th, const std::string server )
00039 : m_handler( th ), m_server( server ), m_secure( false ), m_valid( false ) {}
00040
00044 virtual ~TLSBase() {}
00045
00052 virtual bool encrypt( const std::string& data ) = 0;
00053
00061 virtual int decrypt( const std::string& data ) = 0;
00062
00066 virtual void cleanup() = 0;
00067
00075 virtual bool handshake() = 0;
00076
00081 virtual bool isSecure() const { return m_secure; }
00082
00088 virtual void setCACerts( const StringList& cacerts ) = 0;
00089
00094 virtual const CertInfo& fetchTLSInfo() const { return m_certInfo; }
00095
00107 virtual void setClientCert( const std::string& clientKey, const std::string& clientCerts ) = 0;
00108
00109 protected:
00110 TLSHandler *m_handler;
00111 StringList m_cacerts;
00112 std::string m_clientKey;
00113 std::string m_clientCerts;
00114 std::string m_server;
00115 CertInfo m_certInfo;
00116 bool m_secure;
00117 bool m_valid;
00118
00119 };
00120
00121 }
00122
00123 #endif // TLSBASE_H__