tlsbase.h

00001 /*
00002   Copyright (c) 2007-2008 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 
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__

Generated on Fri Oct 10 15:26:12 2008 for gloox by  doxygen 1.5.6