Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

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 ), m_initLib( true )
00040       {}
00041 
00045       virtual ~TLSBase() {}
00046 
00053       virtual bool init() = 0;
00054 
00062       void setInitLib( bool init ) { m_initLib = init; }
00063 
00070       virtual bool encrypt( const std::string& data ) = 0;
00071 
00079       virtual int decrypt( const std::string& data ) = 0;
00080 
00084       virtual void cleanup() = 0;
00085 
00093       virtual bool handshake() = 0;
00094 
00099       virtual bool isSecure() const { return m_secure; }
00100 
00106       virtual void setCACerts( const StringList& cacerts ) = 0;
00107 
00112       virtual const CertInfo& fetchTLSInfo() const { return m_certInfo; }
00113 
00125       virtual void setClientCert( const std::string& clientKey, const std::string& clientCerts ) = 0;
00126 
00127     protected:
00128       TLSHandler* m_handler;
00129       StringList m_cacerts;
00130       std::string m_clientKey;
00131       std::string m_clientCerts;
00132       std::string m_server;
00133       CertInfo m_certInfo;
00134       bool m_secure;
00135       bool m_valid;
00136       bool m_initLib;
00137 
00138   };
00139 
00140 }
00141 
00142 #endif // TLSBASE_H__

Generated on Mon Nov 17 02:45:13 2008 for gloox by  doxygen 1.4.1