15 #include "tlsgnutlsclientanon.h"
32 gnutls_anon_free_client_credentials( m_anoncred );
41 void GnuTLSClientAnon::init()
43 const int protocolPriority[] = { GNUTLS_TLS1, 0 };
44 const int kxPriority[] = { GNUTLS_KX_ANON_DH, 0 };
45 const int cipherPriority[] = { GNUTLS_CIPHER_AES_256_CBC, GNUTLS_CIPHER_AES_128_CBC,
46 GNUTLS_CIPHER_3DES_CBC, GNUTLS_CIPHER_ARCFOUR, 0 };
47 const int compPriority[] = { GNUTLS_COMP_ZLIB, GNUTLS_COMP_NULL, 0 };
48 const int macPriority[] = { GNUTLS_MAC_SHA, GNUTLS_MAC_MD5, 0 };
50 if( gnutls_global_init() != 0 )
53 if( gnutls_anon_allocate_client_credentials( &m_anoncred ) < 0 )
56 if( gnutls_init( m_session, GNUTLS_CLIENT ) != 0 )
59 gnutls_protocol_set_priority( *m_session, protocolPriority );
60 gnutls_cipher_set_priority( *m_session, cipherPriority );
61 gnutls_compression_set_priority( *m_session, compPriority );
62 gnutls_kx_set_priority( *m_session, kxPriority );
63 gnutls_mac_set_priority( *m_session, macPriority );
64 gnutls_credentials_set( *m_session, GNUTLS_CRD_ANON, m_anoncred );
66 gnutls_transport_set_ptr( *m_session, (gnutls_transport_ptr_t)
this );
67 gnutls_transport_set_push_function( *m_session, pushFunc );
68 gnutls_transport_set_pull_function( *m_session, pullFunc );
71 void GnuTLSClientAnon::getCertInfo()
76 info = gnutls_compression_get_name( gnutls_compression_get( *m_session ) );
80 info = gnutls_mac_get_name( gnutls_mac_get( *m_session ) );
82 m_certInfo.
mac = info;
84 info = gnutls_cipher_get_name( gnutls_cipher_get( *m_session ) );
88 info = gnutls_protocol_get_name( gnutls_protocol_get_version( *m_session ) );