tlsgnutlsclient.h

00001 /*
00002   Copyright (c) 2007-2008 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 #ifdef _WIN32
00021 # include "../config.h.win"
00022 #elif defined( _WIN32_WCE )
00023 # include "../config.h.win"
00024 #else
00025 # include "config.h"
00026 #endif
00027 
00028 #ifdef HAVE_GNUTLS
00029 
00030 #include <gnutls/gnutls.h>
00031 #include <gnutls/x509.h>
00032 
00033 namespace gloox
00034 {
00035 
00044   class GnuTLSClient : public GnuTLSBase
00045   {
00046     public:
00052       GnuTLSClient( TLSHandler *th, const std::string& server );
00053 
00057       virtual ~GnuTLSClient();
00058 
00059       // reimplemented from TLSBase
00060       virtual void setCACerts( const StringList& cacerts );
00061 
00062       // reimplemented from TLSBase
00063       virtual void setClientCert( const std::string& clientKey, const std::string& clientCerts );
00064 
00065       // re-implemented from TLSBase
00066       virtual void cleanup();
00067 
00068     private:
00069       virtual void init();
00070       virtual void getCertInfo();
00071 
00072       bool verifyAgainst( gnutls_x509_crt_t cert, gnutls_x509_crt_t issuer );
00073       bool verifyAgainstCAs( gnutls_x509_crt_t cert, gnutls_x509_crt_t *CAList, int CAListSize );
00074 
00075       gnutls_certificate_credentials m_credentials;
00076 
00077   };
00078 
00079 }
00080 
00081 #endif // HAVE_GNUTLS
00082 
00083 #endif // TLSGNUTLSCLIENT_H__

Generated on Fri Oct 10 15:26:12 2008 for gloox by  doxygen 1.5.6