gloox  1.0.28
tlsdefault.h
1 /*
2  * Copyright (c) 2007-2023 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 const std::string channelBindingType() const;
92 
93  // reimplemented from TLSBase
94  virtual void setCACerts( const StringList& cacerts );
95 
96  // reimplemented from TLSBase
97  virtual const CertInfo& fetchTLSInfo() const;
98 
99  // reimplemented from TLSBase
100  virtual void setClientCert( const std::string& clientKey, const std::string& clientCerts );
101 
106  static int types();
107 
108  private:
109  TLSBase* m_impl;
110 
111  };
112 }
113 
114 #endif // TLSDEFAULT_H__
An abstract base class for TLS implementations.
Definition: tlsbase.h:32
This is an abstraction of the various TLS backends.
Definition: tlsdefault.h:34
An interface that allows for interacting with TLS implementations derived from TLSBase.
Definition: tlshandler.h:35
The namespace for the gloox library.
Definition: adhoc.cpp:28
std::list< std::string > StringList
Definition: gloox.h:1251
const std::string EmptyString
Definition: gloox.cpp:124