gnutls-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU gnutls branch, master, updated. gnutls_2_9_9-25-g8d7fd37


From: Simon Josefsson
Subject: [SCM] GNU gnutls branch, master, updated. gnutls_2_9_9-25-g8d7fd37
Date: Fri, 04 Dec 2009 12:37:44 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU gnutls".

http://git.savannah.gnu.org/cgit/gnutls.git/commit/?id=8d7fd3776ca104cf92a8ebae05ef7a270bd8e95b

The branch, master has been updated
       via  8d7fd3776ca104cf92a8ebae05ef7a270bd8e95b (commit)
      from  3679ef1f47f52134b05c5a3bdf9ec7a7b1993d0f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 8d7fd3776ca104cf92a8ebae05ef7a270bd8e95b
Author: Simon Josefsson <address@hidden>
Date:   Fri Dec 4 13:36:58 2009 +0100

    Improve example of printing cert info.

-----------------------------------------------------------------------

Summary of changes:
 doc/examples/ex-x509-info.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/doc/examples/ex-x509-info.c b/doc/examples/ex-x509-info.c
index 6e575c3..aaddb47 100644
--- a/doc/examples/ex-x509-info.c
+++ b/doc/examples/ex-x509-info.c
@@ -39,13 +39,14 @@ void
 print_x509_certificate_info (gnutls_session_t session)
 {
   char serial[40];
-  char dn[128];
+  char dn[256];
   size_t size;
   unsigned int algo, bits;
   time_t expiration_time, activation_time;
   const gnutls_datum_t *cert_list;
   unsigned int cert_list_size = 0;
   gnutls_x509_crt_t cert;
+  gnutls_datum_t cinfo;
 
   /* This function only works for X.509 certificates.
    */
@@ -58,6 +59,7 @@ print_x509_certificate_info (gnutls_session_t session)
 
   if (cert_list_size > 0)
     {
+      int ret;
 
       /* we only print information about the first certificate.
        */
@@ -67,6 +69,19 @@ print_x509_certificate_info (gnutls_session_t session)
 
       printf ("Certificate info:\n");
 
+      /* This is the preferred way of printing short information about
+        a certificate. */
+
+      ret = gnutls_x509_crt_print (cert, GNUTLS_CRT_PRINT_ONELINE, &cinfo);
+      if (ret == 0)
+       {
+         printf ("\t%s\n", cinfo.data);
+         gnutls_free (cinfo.data);
+       }
+
+      /* If you want to extract fields manually for some other reason,
+        below are popular example calls. */
+
       expiration_time = gnutls_x509_crt_get_expiration_time (cert);
       activation_time = gnutls_x509_crt_get_activation_time (cert);
 
@@ -87,7 +102,7 @@ print_x509_certificate_info (gnutls_session_t session)
       printf ("Certificate public key: %s",
              gnutls_pk_algorithm_get_name (algo));
 
-      /* Print the version of the X.509 
+      /* Print the version of the X.509
        * certificate.
        */
       printf ("\tCertificate version: #%d\n",


hooks/post-receive
-- 
GNU gnutls




reply via email to

[Prev in Thread] Current Thread [Next in Thread]