gloox
1.0
|
00001 /* 00002 Copyright (c) 2007-2009 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 TLSGNUTLSCLIENT_H__ 00016 #define TLSGNUTLSCLIENT_H__ 00017 00018 #include "tlsgnutlsbase.h" 00019 00020 #include "config.h" 00021 00022 #ifdef HAVE_GNUTLS 00023 00024 #include <gnutls/gnutls.h> 00025 #include <gnutls/x509.h> 00026 00027 namespace gloox 00028 { 00029 00038 class GnuTLSClient : public GnuTLSBase 00039 { 00040 public: 00046 GnuTLSClient( TLSHandler* th, const std::string& server ); 00047 00051 virtual ~GnuTLSClient(); 00052 00053 // reimplemented from TLSBase 00054 virtual bool init( const std::string& clientKey = EmptyString, 00055 const std::string& clientCerts = EmptyString, 00056 const StringList& cacerts = StringList() ); 00057 00058 // reimplemented from TLSBase 00059 virtual void setCACerts( const StringList& cacerts ); 00060 00061 // reimplemented from TLSBase 00062 virtual void setClientCert( const std::string& clientKey, const std::string& clientCerts ); 00063 00064 // reimplemented from TLSBase 00065 virtual void cleanup(); 00066 00067 private: 00068 virtual void getCertInfo(); 00069 00070 bool verifyAgainst( gnutls_x509_crt_t cert, gnutls_x509_crt_t issuer ); 00071 bool verifyAgainstCAs( gnutls_x509_crt_t cert, gnutls_x509_crt_t *CAList, int CAListSize ); 00072 00073 gnutls_certificate_credentials m_credentials; 00074 00075 }; 00076 00077 } 00078 00079 #endif // HAVE_GNUTLS 00080 00081 #endif // TLSGNUTLSCLIENT_H__