]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
updated the basic client to support OpenPGP certificate authentication.
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Thu, 14 Nov 2002 09:19:56 +0000 (09:19 +0000)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Thu, 14 Nov 2002 09:19:56 +0000 (09:19 +0000)
doc/tex/ex-client2.tex
doc/tex/examples.tex

index 646e78a86e6f7df6065ff6743804b20d237adc10..cebb584c8fe3c9d7c0fa016fc57bf1a8a3ed6fd2 100644 (file)
@@ -28,12 +28,10 @@ int main()
    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();
 
@@ -62,27 +60,9 @@ int main()
     */
    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
     */
index 2966ad818ffa80cde6eea9632991c33e31c874f9..eceececac0253383f3947c48cbd203ca565d668a 100644 (file)
@@ -7,7 +7,7 @@ Note that these examples contain little or no error checking.
 
 \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}