15 #include "tlsgnutlsclientanon.h"
31 gnutls_anon_free_client_credentials( m_anoncred );
44 const int protocolPriority[] = { GNUTLS_TLS1, 0 };
45 const int kxPriority[] = { GNUTLS_KX_ANON_DH, 0 };
46 const int cipherPriority[] = { GNUTLS_CIPHER_AES_256_CBC, GNUTLS_CIPHER_AES_128_CBC,
47 GNUTLS_CIPHER_3DES_CBC, GNUTLS_CIPHER_ARCFOUR, 0 };
48 const int compPriority[] = { GNUTLS_COMP_ZLIB, GNUTLS_COMP_NULL, 0 };
49 const int macPriority[] = { GNUTLS_MAC_SHA, GNUTLS_MAC_MD5, 0 };
51 if( m_initLib && gnutls_global_init() != 0 )
54 if( gnutls_anon_allocate_client_credentials( &m_anoncred ) < 0 )
57 if( gnutls_init( m_session, GNUTLS_CLIENT ) != 0 )
60 gnutls_protocol_set_priority( *m_session, protocolPriority );
61 gnutls_cipher_set_priority( *m_session, cipherPriority );
62 gnutls_compression_set_priority( *m_session, compPriority );
63 gnutls_kx_set_priority( *m_session, kxPriority );
64 gnutls_mac_set_priority( *m_session, macPriority );
65 gnutls_credentials_set( *m_session, GNUTLS_CRD_ANON, m_anoncred );
67 gnutls_transport_set_ptr( *m_session, (gnutls_transport_ptr_t)
this );
68 gnutls_transport_set_push_function( *m_session, pushFunc );
69 gnutls_transport_set_pull_function( *m_session, pullFunc );
75 void GnuTLSClientAnon::getCertInfo()
80 info = gnutls_compression_get_name( gnutls_compression_get( *m_session ) );
84 info = gnutls_mac_get_name( gnutls_mac_get( *m_session ) );
86 m_certInfo.
mac = info;
88 info = gnutls_cipher_get_name( gnutls_cipher_get( *m_session ) );
92 info = gnutls_protocol_get_name( gnutls_protocol_get_version( *m_session ) );
101 #endif // HAVE_GNUTLS