[pisa-src] r2958 - trunk/pairing/util/pisa-cert-info.c

  • From: Christoph Viethen <christoph.viethen@xxxxxxxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Mon, 26 Mar 2012 08:03:47 +0200

Author: viethen
Date: Mon Mar 26 08:03:46 2012
New Revision: 2958

Log:
Fix defective display of X.509v3 certificate extensions.

Correct a few text strings.

Modified:
   trunk/pairing/util/pisa-cert-info.c

Modified: trunk/pairing/util/pisa-cert-info.c
==============================================================================
--- trunk/pairing/util/pisa-cert-info.c Sun Mar 25 22:54:22 2012        (r2957)
+++ trunk/pairing/util/pisa-cert-info.c Mon Mar 26 08:03:46 2012        (r2958)
@@ -18,6 +18,7 @@
 #include <openssl/asn1.h>
 #include <openssl/pem.h>
 #include <openssl/x509.h>
+#include <openssl/x509v3.h>
 
 /* some helper functions to simplify output of table information */
 static void topen(BIO *bp)
@@ -71,10 +72,10 @@
     BIO_printf(bp, "<table style=\"width: 90%%; margin-left: 2.5em; ");
     BIO_printf(bp, "text-align: left; font-size: 0.8em;\" ");
     BIO_printf(bp, "border=\"0\" cellpadding=\"2\" cellspacing=\"1\" ");
-    BIO_printf(bp, "summary=\"@TR<<Certification>>\">\n");
+    BIO_printf(bp, "summary=\"@TR<<Certificate Data>>\">\n");
     BIO_printf(bp, "<tr><td><table style=\"margin-left: 0.2em; ");
     BIO_printf(bp, "text-align: left;\" border=\"0\" cellpadding=\"1\" ");
-    BIO_printf(bp, "cellspacing= \"8\" summary=\"@TR<<Certification>>\">\n");
+    BIO_printf(bp, "cellspacing= \"8\">\n");
     version = X509_get_version(x);
     if (BIO_printf(bp, "<tr><td>Version</td><td>%lu (0x%lx)</td></tr>\n",
                    version + 1, version) <= 0) {
@@ -178,10 +179,10 @@
         BIO_printf(bp, "<table style=\"width: 90%%; margin-left: 2.5em; ");
         BIO_printf(bp, "text-align: left; font-size: 1em;\" border=\"0\" ");
         BIO_printf(bp, "cellpadding=\"2\" cellspacing=\"1\" ");
-        BIO_printf(bp, "summary=\"@TR<<Certification>>\">" );
+        BIO_printf(bp, "summary=\"@TR<<Certificate Extensions>>\">" );
         BIO_printf(bp, "<tr><td><table style=\"margin-left: 0.2em; ");
         BIO_printf(bp, "text-align: left;\" border=\"0\" cellpadding=\"1\" ");
-        BIO_printf(bp, "cellspacing=\"8\" summary=\"@TR<<Certification>>\">\n 
");
+        BIO_printf(bp, "cellspacing=\"8\">\n ");
         for (i = 0; i < number_ext; i++) {
             ASN1_OBJECT *obj;
             ex  = X509_get_ext(x, i);
@@ -190,9 +191,13 @@
             i2a_ASN1_OBJECT(bp, obj);
             j   = X509_EXTENSION_get_critical(ex);
             tnext(bp);
-            if (BIO_printf(bp, "%1s", j ? "critical" : "") <= 0) {
+            if (BIO_printf(bp, "%1s", j ? "(critical)" : "") <= 0) {
                 goto err;
             }
+            if(!X509V3_EXT_print(bp, ex, X509V3_EXT_ERROR_UNKNOWN, 0)) {
+                BIO_printf(bp, "%*s", 0, "");
+                M_ASN1_OCTET_STRING_print(bp,ex->value);
+            }
             tclose(bp);
         }
     }
-- 
This is the pisa developer mailing list. Please also subscribe to the main pisa 
list at:
//www.freelists.org/list/pisa

Other related posts:

  • » [pisa-src] r2958 - trunk/pairing/util/pisa-cert-info.c - Christoph Viethen