]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
*** empty log message ***
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Wed, 19 Mar 2003 09:18:09 +0000 (09:18 +0000)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Wed, 19 Mar 2003 09:18:09 +0000 (09:18 +0000)
doc/examples/Makefile.am
doc/tex/Makefile.am
doc/tex/ex-session-info.tex [new file with mode: 0644]
doc/tex/ex-x509-info.tex [moved from doc/tex/ex-info.tex with 59% similarity]
doc/tex/examples.tex

index e754fceb0093ce877c8cb7fbfac8817ecc54c87e..4cdbd1c402398e18da295466cb840927bd211716 100644 (file)
@@ -1,4 +1,4 @@
 EXTRA_DIST = ex-alert.c ex-client-resume.c ex-client-srp.c ex-client1.c \
-       ex-client2.c ex-info.c ex-rfc2818.c ex-serv-export.c ex-serv-pgp.c \
+       ex-client2.c ex-x509-info.c ex-rfc2818.c ex-serv-export.c ex-serv-pgp.c \
        ex-serv-srp.c ex-serv1.c ex-pgp-keyserver.c ex-cert-select.c \
-       ex-crq.c
+       ex-crq.c ex-session-info.c
index 9bac61517a038255aac8e804e1b0bbb65ac1e38f..419fda8749ae02b08b125fd9a66aeb91c09998a3 100644 (file)
@@ -5,10 +5,10 @@ EXTRA_DIST = gnutls.tex gnutls.ps \
 # If you add any examples here, also change the ../examples/Makefile.am
 # to include the C source.
 EXAMPLE_OBJECTS = ex-alert.tex ex-client-srp.tex ex-serv-export.tex \
-       ex-client1.tex ex-client2.tex ex-info.tex ex-rfc2818.tex \
+       ex-client1.tex ex-client2.tex ex-x509-info.tex ex-rfc2818.tex \
        ex-serv1.tex ex-client-resume.tex ex-serv-srp.tex \
        ex-serv-pgp.tex ex-pgp-keyserver.tex ex-cert-select.tex \
-       ex-crq.tex
+       ex-crq.tex ex-session-info.tex
 
 TEX_OBJECTS = gnutls.tex ../../lib/gnutls-api.tex fdl.tex ../../lib/x509/x509-api.tex \
        macros.tex cover.tex ciphersuites.tex handshake.tex translayer.tex \
diff --git a/doc/tex/ex-session-info.tex b/doc/tex/ex-session-info.tex
new file mode 100644 (file)
index 0000000..243469c
--- /dev/null
@@ -0,0 +1,85 @@
+\begin{verbatim}
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <gnutls/gnutls.h>
+#include <gnutls/x509.h>
+
+extern void print_x509_certificate_info(gnutls_session);
+
+/* This function will print some details of the
+ * given session.
+ */
+int print_info(gnutls_session session)
+{
+   const char *tmp;
+   gnutls_credentials_type cred;
+   gnutls_kx_algorithm kx;
+
+   /* print the key exchange's algorithm name
+    */
+   kx = gnutls_kx_get(session);
+   tmp = gnutls_kx_get_name(kx);
+   printf("- Key Exchange: %s\n", tmp);
+
+   /* Check the authentication type used and switch
+    * to the appropriate.
+    */
+   cred = gnutls_auth_get_type(session);
+   switch (cred) {
+   case GNUTLS_CRD_ANON:       /* anonymous authentication */
+
+      printf("- Anonymous DH using prime of %d bits\n",
+             gnutls_dh_get_prime_bits(session));
+      break;
+
+   case GNUTLS_CRD_CERTIFICATE:        /* certificate authentication */
+      
+      /* Check if we have been using ephemeral Diffie Hellman.
+       */
+      if (kx == GNUTLS_KX_DHE_RSA || kx == GNUTLS_KX_DHE_DSS) {
+         printf("\n- Ephemeral DH using prime of %d bits\n",
+                gnutls_dh_get_prime_bits(session));
+      }
+
+      /* if the certificate list is available, then
+       * print some information about it.
+       */
+      print_x509_certificate_info(session);
+
+   } /* switch */
+
+   /* print the protocol's name (ie TLS 1.0) 
+    */
+   tmp = gnutls_protocol_get_name(gnutls_protocol_get_version(session));
+   printf("- Protocol: %s\n", tmp);
+
+   /* print the certificate type of the peer.
+    * ie X.509
+    */
+   tmp = gnutls_certificate_type_get_name(
+      gnutls_certificate_type_get(session));
+
+   printf("- Certificate Type: %s\n", tmp);
+
+   /* print the compression algorithm (if any)
+    */
+   tmp = gnutls_compression_get_name( gnutls_compression_get(session));
+   printf("- Compression: %s\n", tmp);
+
+   /* print the name of the cipher used.
+    * ie 3DES.
+    */
+   tmp = gnutls_cipher_get_name(gnutls_cipher_get(session));
+   printf("- Cipher: %s\n", tmp);
+
+   /* Print the MAC algorithms name.
+    * ie SHA1
+    */
+   tmp = gnutls_mac_get_name(gnutls_mac_get(session));
+   printf("- MAC: %s\n", tmp);
+
+   return 0;
+}
+
+\end{verbatim}
similarity index 59%
rename from doc/tex/ex-info.tex
rename to doc/tex/ex-x509-info.tex
index c1deed9cc7a0dc2d752d98416a58018dc12f4f98..3b23821fd50a9632141c6633d84b6b85f3597715 100644 (file)
@@ -5,83 +5,6 @@
 #include <gnutls/gnutls.h>
 #include <gnutls/x509.h>
 
-static void print_x509_certificate_info(gnutls_session);
-
-/* This function will print some details of the
- * given session.
- */
-int print_info(gnutls_session session)
-{
-   const char *tmp;
-   gnutls_credentials_type cred;
-   gnutls_kx_algorithm kx;
-
-   /* print the key exchange's algorithm name
-    */
-   kx = gnutls_kx_get(session);
-   tmp = gnutls_kx_get_name(kx);
-   printf("- Key Exchange: %s\n", tmp);
-
-   /* Check the authentication type used and switch
-    * to the appropriate.
-    */
-   cred = gnutls_auth_get_type(session);
-   switch (cred) {
-   case GNUTLS_CRD_ANON:       /* anonymous authentication */
-
-      printf("- Anonymous DH using prime of %d bits\n",
-             gnutls_dh_get_prime_bits(session));
-      break;
-
-   case GNUTLS_CRD_CERTIFICATE:        /* certificate authentication */
-      
-      /* Check if we have been using ephemeral Diffie Hellman.
-       */
-      if (kx == GNUTLS_KX_DHE_RSA || kx == GNUTLS_KX_DHE_DSS) {
-         printf("\n- Ephemeral DH using prime of %d bits\n",
-                gnutls_dh_get_prime_bits(session));
-      }
-
-      /* if the certificate list is available, then
-       * print some information about it.
-       */
-      print_x509_certificate_info(session);
-
-   } /* switch */
-
-   /* print the protocol's name (ie TLS 1.0) 
-    */
-   tmp = gnutls_protocol_get_name(gnutls_protocol_get_version(session));
-   printf("- Protocol: %s\n", tmp);
-
-   /* print the certificate type of the peer.
-    * ie X.509
-    */
-   tmp = gnutls_certificate_type_get_name(
-      gnutls_certificate_type_get(session));
-
-   printf("- Certificate Type: %s\n", tmp);
-
-   /* print the compression algorithm (if any)
-    */
-   tmp = gnutls_compression_get_name( gnutls_compression_get(session));
-   printf("- Compression: %s\n", tmp);
-
-   /* print the name of the cipher used.
-    * ie 3DES.
-    */
-   tmp = gnutls_cipher_get_name(gnutls_cipher_get(session));
-   printf("- Cipher: %s\n", tmp);
-
-   /* Print the MAC algorithms name.
-    * ie SHA1
-    */
-   tmp = gnutls_mac_get_name(gnutls_mac_get(session));
-   printf("- MAC: %s\n", tmp);
-
-   return 0;
-}
-
 /* This function will print information about this session's peer
  * certificate. 
  */
index fa041e64f51d4efd8c3c279af334b808ed2ac7d8..0c2c0d788f3ce7877af9797488bf2f57b29f7eb7 100644 (file)
@@ -14,6 +14,14 @@ is a very simple \tls{} client, it does not support session resuming nor
 any other fancy features.
 \input{ex-client2}
 
+\subsection{Obtaining session information}
+The following function  prints some information about the current session.
+\par
+This function should be called after a successful
+\printfunc{gnutls_handshake}{gnutls\_handshake}
+
+\input{ex-session-info}
+
 \subsection{Verifying peer's certificate}
 \par A TLS connection is not secure just after the handshake has finished.
 It must be considered secure, after the peer's identity has been
@@ -98,7 +106,7 @@ and prints some information about the certificate and the current session.
 This function should be called after a successful
 \printfunc{gnutls_handshake}{gnutls\_handshake}
 
-\input{ex-info}
+\input{ex-x509-info}
 
 \subsection{Generating a certificate request}
 The following example is about generating a certificate request, and