]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
*** empty log message ***
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Mon, 17 Nov 2003 17:39:38 +0000 (17:39 +0000)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Mon, 17 Nov 2003 17:39:38 +0000 (17:39 +0000)
doc/tex/ex-client-resume.tex
doc/tex/ex-client-srp.tex
doc/tex/ex-client2.tex
doc/tex/ex-rfc2818.tex
doc/tex/examples.tex

index df2f244ad6ab37fcaa7db56803ee817ae670f465..12e634f18fb01c393191d2592738f16c0c6b9eae 100644 (file)
@@ -97,13 +97,14 @@ int main()
       } else if (ret < 0) {
          fprintf(stderr, "*** Error: %s\n", gnutls_strerror(ret));
          goto end;
-      } else if (ret > 0) {
-         printf("- Received %d bytes: ", ret);
-         for (ii = 0; ii < ret; ii++) {
-            fputc(buffer[ii], stdout);
-         }
-         fputs("\n", stdout);
       }
+
+      printf("- Received %d bytes: ", ret);
+      for (ii = 0; ii < ret; ii++) {
+         fputc(buffer[ii], stdout);
+      }
+      fputs("\n", stdout);
+
       gnutls_bye( session, GNUTLS_SHUT_RDWR);
 
     end:
index 9a9b83ab0c8c94140a6cd7cef3264ee1373d18cb..4cca62c0bdbdac28689d980bfd19c1de9aeb7af3 100644 (file)
@@ -57,9 +57,6 @@ int main()
    /* Set the priorities.
     */
    gnutls_set_default_priority(session);
-   /* use GNUTLS_KX_SRP
-    */
    gnutls_kx_set_priority(session, kx_priority);
  
 
index bdd577d837b9093c221cb428f3329f9ea609603d..37184c6ed630cd45bcf0950389b83e8d3d86029d 100644 (file)
@@ -114,13 +114,14 @@ int main()
    } else if (ret < 0) {
       fprintf(stderr, "*** Error: %s\n", gnutls_strerror(ret));
       goto end;
-   } else if (ret > 0) {
-      printf("- Received %d bytes: ", ret);
-      for (ii = 0; ii < ret; ii++) {
-         fputc(buffer[ii], stdout);
-      }
-      fputs("\n", stdout);
    }
+
+   printf("- Received %d bytes: ", ret);
+   for (ii = 0; ii < ret; ii++) {
+      fputc(buffer[ii], stdout);
+   }
+   fputs("\n", stdout);
+
    gnutls_bye( session, GNUTLS_SHUT_RDWR);
 
  end:
index 6d3a36f22911e33415bc14096f7d04aa80458a3b..b32095b288c58b796e84df5327a0173bde6016b9 100644 (file)
@@ -16,10 +16,6 @@ void verify_certificate( gnutls_session session, const char* hostname)
    int cert_list_size;
    gnutls_x509_crt cert;
 
-   /* This function only works with X.509 certificates.
-    */
-   if ( gnutls_certificate_type_get(session) != GNUTLS_CRT_X509)
-      return;
 
    /* This verification function uses the trusted CAs in the credentials
     * structure. So you must have installed one or more CA certificates.
@@ -41,6 +37,13 @@ void verify_certificate( gnutls_session session, const char* hostname)
      printf("The certificate has been revoked.\n");
 
 
+   /* Up to here the process is the same for X.509 certificates and
+    * OpenPGP keys. From now on X.509 certificates are assumed. This can
+    * be easily extended to work with openpgp keys as well.
+    */
+   if ( gnutls_certificate_type_get(session) != GNUTLS_CRT_X509)
+      return;
+
    if ( gnutls_x509_crt_init( &cert) < 0) {
       printf("error in initialization\n");
       return;
@@ -73,7 +76,7 @@ void verify_certificate( gnutls_session session, const char* hostname)
    }
 
    if ( !gnutls_x509_crt_check_hostname( cert, hostname)) {
-      printf("The certificate does not match hostname\n");
+      printf("The certificate's owner does not match hostname '%s'\n", hostname);
       return;
    }
 
index 1a93aec0bb1019326f65e80935b72ccdb6dc373c..2e9fc22fde933d0cc29e7c0340e6e67f9448a8ef 100644 (file)
@@ -17,16 +17,15 @@ are used in most of the other examples below, without redefining them.
 
 \subsection{Obtaining session information}
 The following function prints information about the current \tls{} 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
-verified. That is, you usually have to verify not only the peer's 
+A TLS connection is not secure just after the handshake has finished.
+It must be considered secure, after the peer's certificate and identity have been
+verified. That is, you usually have to verify not only the signature in peer's 
 certificate, but also the hostname in the certificate, expiration dates etc. 
 After this step you should treat the connection as being a secure one.