gloox  0.9.9.12
tlsdefault.h
1 /*
2  * Copyright (c) 2007-2008 by Jakob Schroeter <js@camaya.net>
3  * This file is part of the gloox library. http://camaya.net/gloox
4  *
5  * This software is distributed under a license. The full license
6  * agreement can be found in the file LICENSE in this distribution.
7  * This software may not be copied, modified, sold or distributed
8  * other than expressed in the named license agreement.
9  *
10  * This software is distributed without any warranty.
11  */
12 
13 
14 #ifndef TLSDEFAULT_H__
15 #define TLSDEFAULT_H__
16 
17 #include "tlsbase.h"
18 
19 namespace gloox
20 {
21 
22  class TLSHandler;
23 
30  class GLOOX_API TLSDefault : public TLSBase
31  {
32  public:
33 
37  enum Type
38  {
39  VerifyingClient = 1,
41  AnonymousClient = 2,
43  VerifyingServer = 4,
44  AnonymousServer = 8
46  };
47 
54  TLSDefault( TLSHandler *th, const std::string server, Type type = VerifyingClient );
55 
59  virtual ~TLSDefault();
60 
61  // re-implemented from TLSBase
62  virtual bool encrypt( const std::string& data );
63 
64  // re-implemented from TLSBase
65  virtual int decrypt( const std::string& data );
66 
67  // re-implemented from TLSBase
68  virtual void cleanup();
69 
70  // re-implemented from TLSBase
71  virtual bool handshake();
72 
73  // re-implemented from TLSBase
74  virtual bool isSecure() const;
75 
76  // re-implemented from TLSBase
77  virtual void setCACerts( const StringList& cacerts );
78 
79  // re-implemented from TLSBase
80  virtual const CertInfo& fetchTLSInfo() const;
81 
82  // re-implemented from TLSBase
83  virtual void setClientCert( const std::string& clientKey, const std::string& clientCerts );
84 
89  static int types();
90 
91  private:
92  TLSBase* m_impl;
93  };
94 }
95 
96 #endif // TLSDEFAULT_H__