gnutls-commit
[Top][All Lists]
Advanced

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

[SCM] GNU gnutls branch, gnutls_2_8_x, updated. gnutls_2_8_5-10-gfd29562


From: Simon Josefsson
Subject: [SCM] GNU gnutls branch, gnutls_2_8_x, updated. gnutls_2_8_5-10-gfd29562
Date: Fri, 04 Dec 2009 12:37:06 +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=fd29562630a701fadbfbf316ce323a248a3ccd43

The branch, gnutls_2_8_x has been updated
       via  fd29562630a701fadbfbf316ce323a248a3ccd43 (commit)
      from  fc3ec52190ee598540107248d693688b83b2bc62 (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 fd29562630a701fadbfbf316ce323a248a3ccd43
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]