gloox  1.0.20
tlsdefault.h
1 /*
2  * Copyright (c) 2007-2017 by Jakob Schröter <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 
33  class GLOOX_API TLSDefault : public TLSBase
34  {
35  public:
36 
40  enum Type
41  {
42  VerifyingClient = 1,
44  AnonymousClient = 2,
46  VerifyingServer = 4,
47  AnonymousServer = 8
49  };
50 
57  TLSDefault( TLSHandler* th, const std::string server, Type type = VerifyingClient );
58 
62  virtual ~TLSDefault();
63 
64  // reimplemented from TLSBase
65  virtual bool init( const std::string& clientKey = EmptyString,
66  const std::string& clientCerts = EmptyString,
67  const StringList& cacerts = StringList() );
68 
69  // reimplemented from TLSBase
70  virtual bool encrypt( const std::string& data );
71 
72  // reimplemented from TLSBase
73  virtual int decrypt( const std::string& data );
74 
75  // reimplemented from TLSBase
76  virtual void cleanup();
77 
78  // reimplemented from TLSBase
79  virtual bool handshake();
80 
81  // reimplemented from TLSBase
82  virtual bool isSecure() const;
83 
84  // reimplemented from TLSBase
85  virtual bool hasChannelBinding() const;
86 
87  // reimplemented from TLSBase
88  virtual const std::string channelBinding() const;
89 
90  // reimplemented from TLSBase
91  virtual void setCACerts( const StringList& cacerts );
92 
93  // reimplemented from TLSBase
94  virtual const CertInfo& fetchTLSInfo() const;
95 
96  // reimplemented from TLSBase
97  virtual void setClientCert( const std::string& clientKey, const std::string& clientCerts );
98 
103  static int types();
104 
105  private:
106  TLSBase* m_impl;
107 
108  };
109 }
110 
111 #endif // TLSDEFAULT_H__
std::list< std::string > StringList
Definition: gloox.h:1251
This is an abstraction of the various TLS backends.
Definition: tlsdefault.h:33
The namespace for the gloox library.
Definition: adhoc.cpp:27
An abstract base class for TLS implementations.
Definition: tlsbase.h:31
An interface that allows for interacting with TLS implementations derived from TLSBase.
Definition: tlshandler.h:34
const std::string EmptyString
Definition: gloox.cpp:124