gnutls_session session;
char buffer[MAX_BUF + 1];
gnutls_certificate_client_credentials xcred;
- const int protocol_priority[] = { GNUTLS_TLS1, GNUTLS_SSL3, 0 };
- const int kx_priority[] = { GNUTLS_KX_RSA, 0 };
- const int cipher_priority[] = { GNUTLS_CIPHER_3DES_CBC, GNUTLS_CIPHER_ARCFOUR_128, 0};
- const int comp_priority[] = { GNUTLS_COMP_NULL, 0 };
- const int mac_priority[] = { GNUTLS_MAC_SHA, GNUTLS_MAC_MD5, 0 };
-
+ /* Allow connections to servers that have OpenPGP keys as well.
+ */
+ const int cert_type_priority[2] = { GNUTLS_CRT_X509,
+ GNUTLS_CRT_OPENPGP, 0 };
gnutls_global_init();
*/
gnutls_init(&session, GNUTLS_CLIENT);
- /* allow both SSL3 and TLS1
- */
- gnutls_protocol_set_priority(session, protocol_priority);
-
- /* allow only ARCFOUR and 3DES ciphers
- * (3DES has the highest priority)
- */
- gnutls_cipher_set_priority(session, cipher_priority);
-
- /* only allow null compression
- */
- gnutls_compression_set_priority(session, comp_priority);
-
- /* use GNUTLS_KX_RSA
- */
- gnutls_kx_set_priority(session, kx_priority);
-
- /* allow the usage of both SHA and MD5
- */
- gnutls_mac_set_priority(session, mac_priority);
-
+ /* Use default priorities */
+ gnutls_set_default_priority(session);
+ gnutls_certificate_type_set_priority(session, cert_type_priority);
/* put the x509 credentials to the current session
*/
\subsection{Simple client example with X.509 certificate support}
Let's assume now that we want to create a client which communicates
-with servers using the X.509 authentication schema. The following client
+with servers that use X.509 or OpenPGP certificate authentication. The following client
is a very simple \tls{} client, it does not support session resuming nor
any other fancy features.
\input{ex-client2}