15 #include "tlsgnutlsclientanon.h"
31 gnutls_anon_free_client_credentials( m_anoncred );
44 if( m_initLib && gnutls_global_init() != 0 )
47 if( gnutls_anon_allocate_client_credentials( &m_anoncred ) < 0 )
50 if( gnutls_init( m_session, GNUTLS_CLIENT ) != 0 )
53 #if GNUTLS_VERSION_NUMBER >= 0x020600
54 int ret = gnutls_priority_set_direct( *m_session,
"SECURE128:+PFS:+COMP-ALL:+VERS-TLS-ALL:-VERS-SSL3.0:+SIGN-ALL:+CURVE-ALL:+ANON-ECDH:+ANON-DH", 0 );
55 if( ret != GNUTLS_E_SUCCESS )
58 const int protocolPriority[] = {
62 GNUTLS_TLS1_1, GNUTLS_TLS1, 0 };
63 const int protocolPriority[] = { GNUTLS_TLS1, 0 };
64 const int kxPriority[] = { GNUTLS_KX_ANON_DH, 0 };
65 const int cipherPriority[] = { GNUTLS_CIPHER_AES_256_CBC, GNUTLS_CIPHER_AES_128_CBC,
66 GNUTLS_CIPHER_3DES_CBC, GNUTLS_CIPHER_ARCFOUR, 0 };
67 const int compPriority[] = { GNUTLS_COMP_ZLIB, GNUTLS_COMP_NULL, 0 };
68 const int macPriority[] = { GNUTLS_MAC_SHA, GNUTLS_MAC_MD5, 0 };
69 gnutls_protocol_set_priority( *m_session, protocolPriority );
70 gnutls_cipher_set_priority( *m_session, cipherPriority );
71 gnutls_compression_set_priority( *m_session, compPriority );
72 gnutls_kx_set_priority( *m_session, kxPriority );
73 gnutls_mac_set_priority( *m_session, macPriority );
76 gnutls_credentials_set( *m_session, GNUTLS_CRD_ANON, m_anoncred );
78 gnutls_transport_set_ptr( *m_session,
static_cast<gnutls_transport_ptr_t
>(
this ) );
79 gnutls_transport_set_push_function( *m_session, pushFunc );
80 gnutls_transport_set_pull_function( *m_session, pullFunc );
86 void GnuTLSClientAnon::getCertInfo()
This is the common base class for (stream) encryption using GnuTLS.
virtual ~GnuTLSClientAnon()
virtual bool init(const std::string &clientKey=EmptyString, const std::string &clientCerts=EmptyString, const StringList &cacerts=StringList())
GnuTLSClientAnon(TLSHandler *th)
An interface that allows for interacting with TLS implementations derived from TLSBase.
The namespace for the gloox library.
std::list< std::string > StringList