[rs-commit] r105 - /redwax-tool/trunk/redwax_openssl.c

rs-commit at redwax.eu rs-commit at redwax.eu
Thu Dec 2 11:52:47 CET 2021


Author: minfrin at redwax.eu
Date: Thu Dec  2 11:52:44 2021
New Revision: 105

Log:
Add authority key identifier.

Modified:
    redwax-tool/trunk/redwax_openssl.c

Modified: redwax-tool/trunk/redwax_openssl.c
==============================================================================
--- redwax-tool/trunk/redwax_openssl.c	(original)
+++ redwax-tool/trunk/redwax_openssl.c	Thu Dec  2 11:52:44 2021
@@ -2748,7 +2748,7 @@
     }
     case GEN_DIRNAME: {
         key = "DirName";
-        X509_NAME_print_ex(bio, gen->d.dirn, 0, XN_FLAG_ONELINE);
+        X509_NAME_print_ex(bio, gen->d.dirn, 0, XN_FLAG_RFC2253);
         break;
     }
     case GEN_IPADD: {
@@ -3066,6 +3066,55 @@
                 redwax_pencode_base16_binary(m->pool,
                         oct->data, oct->length,
                         REDWAX_ENCODE_LOWER | REDWAX_ENCODE_COLON, NULL));
+
+        break;
+    }
+    case NID_authority_key_identifier: {
+
+        AUTHORITY_KEYID *akeyid = X509V3_EXT_d2i(ex);
+
+        if (akeyid->keyid) {
+
+            redwax_metadata_add_string(m, "ID",
+                    redwax_pencode_base16_binary(m->pool,
+                            akeyid->keyid->data, akeyid->keyid->length,
+                            REDWAX_ENCODE_LOWER | REDWAX_ENCODE_COLON, NULL));
+        }
+
+        if (akeyid->issuer) {
+
+            redwax_metadata_push_object(m, "Issuer", 0);
+
+            int i;
+
+            if (sk_GENERAL_NAME_num(akeyid->issuer)) {
+
+                redwax_metadata_push_array(m, "Names", 0);
+
+                for (i = 0; i < sk_GENERAL_NAME_num(akeyid->issuer); i++) {
+
+                    GENERAL_NAME *gen;
+
+                    gen = sk_GENERAL_NAME_value(akeyid->issuer, i);
+
+                    redwax_metadata_push_object(m, "Name", 0);
+                    redwax_openssl_general_name_metadata(r, m, gen);
+                    redwax_metadata_pop_object(m);
+                }
+
+                redwax_metadata_pop_array(m);
+            }
+
+            redwax_metadata_pop_object(m);
+        }
+
+        if (akeyid->serial) {
+
+            redwax_metadata_add_string(m, "Serial",
+                    redwax_pencode_base16_binary(m->pool,
+                            akeyid->serial->data, akeyid->serial->length,
+                            REDWAX_ENCODE_LOWER | REDWAX_ENCODE_COLON, NULL));
+        }
 
         break;
     }



More information about the rs-commit mailing list