gloox  1.0
tlsgnutlsserver.h
1 /*
2  Copyright (c) 2007-2009 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 
15 #ifndef TLSGNUTLSSERVER_H__
16 #define TLSGNUTLSSERVER_H__
17 
18 #include "tlsgnutlsbase.h"
19 
20 #include "config.h"
21 
22 #ifdef HAVE_GNUTLS
23 
24 #include <gnutls/gnutls.h>
25 #include <gnutls/x509.h>
26 
27 namespace gloox
28 {
29 
38  class GnuTLSServer : public GnuTLSBase
39  {
40  public:
45  GnuTLSServer( TLSHandler* th );
46 
50  virtual ~GnuTLSServer();
51 
52  // reimplemented from TLSBase
53  virtual bool init( const std::string& clientKey = EmptyString,
54  const std::string& clientCerts = EmptyString,
55  const StringList& cacerts = StringList() );
56 
57  // reimplemented from TLSBase
58  virtual void cleanup();
59 
60  private:
61  // reimplemented from TLSBase
62  virtual void setCACerts( const StringList& cacerts );
63 
64  // reimplemented from TLSBase
65  virtual void setClientCert( const std::string& clientKey,
66  const std::string& clientCerts );
67 
68  virtual void getCertInfo();
69  void generateDH();
70 
71  gnutls_certificate_credentials_t m_x509cred;
72 // gnutls_priority_t m_priorityCache;
73  gnutls_dh_params_t m_dhParams;
74  gnutls_rsa_params_t m_rsaParams;
75  const int m_dhBits;
76 
77  };
78 
79 }
80 
81 #endif // HAVE_GNUTLS
82 
83 #endif // TLSGNUTLSSERVER_H__