[rt-commit] r143 - in /redwax-tool/trunk: ChangeLog redwax-tool.c redwax-tool.h redwax_openssl.c

rt-commit at redwax.eu rt-commit at redwax.eu
Tue Jul 18 16:27:55 CEST 2023


Author: minfrin at redwax.eu
Date: Tue Jul 18 16:27:53 2023
New Revision: 143

Log:
Add --parameter-out and --no-parameter-out to include
parameters with private keys.

Modified:
    redwax-tool/trunk/ChangeLog
    redwax-tool/trunk/redwax-tool.c
    redwax-tool/trunk/redwax-tool.h
    redwax-tool/trunk/redwax_openssl.c

Modified: redwax-tool/trunk/ChangeLog
==============================================================================
--- redwax-tool/trunk/ChangeLog	(original)
+++ redwax-tool/trunk/ChangeLog	Tue Jul 18 16:27:53 2023
@@ -1,3 +1,8 @@
+
+Changes with v0.9.3
+
+ *) Add --parameter-out and --no-parameter-out to include
+    parameters with private keys. [Graham Leggett]
 
 Changes with v0.9.2
 

Modified: redwax-tool/trunk/redwax-tool.c
==============================================================================
--- redwax-tool/trunk/redwax-tool.c	(original)
+++ redwax-tool/trunk/redwax-tool.c	Tue Jul 18 16:27:53 2023
@@ -173,39 +173,41 @@
 #define REDWAX_TOOL_NO_TRUST_OUT 272
 #define REDWAX_TOOL_CRL_OUT 273
 #define REDWAX_TOOL_NO_CRL_OUT 274
-#define REDWAX_TOOL_KEY_IN 275
-#define REDWAX_TOOL_NO_KEY_IN 276
-#define REDWAX_TOOL_KEY_OUT 277
-#define REDWAX_TOOL_NO_KEY_OUT 278
-#define REDWAX_TOOL_AUTO_OUT 279
-#define REDWAX_TOOL_NO_AUTO_OUT 280
-#define REDWAX_TOOL_FILTER_VERIFY_PARAM 281
-#define REDWAX_TOOL_SECRET_SUFFIX_IN 282
-#define REDWAX_TOOL_SECRET_SUFFIX_OUT 283
-#define REDWAX_TOOL_SECRET_TOKEN_IN 284
-#define REDWAX_TOOL_SECRET_TOKEN_OUT 285
-#define REDWAX_TOOL_LABEL_OUT 286
-#define REDWAX_TOOL_NSS_OUT 287
-#define REDWAX_TOOL_NSS_SLOT_OUT 288
-#define REDWAX_TOOL_DER_OUT 289
-#define REDWAX_TOOL_PEM_OUT 290
-#define REDWAX_TOOL_PKCS12_OUT 291
-#define REDWAX_TOOL_PKCS11_OUT 292
-#define REDWAX_TOOL_PKCS11_MODULE_OUT 293
-#define REDWAX_TOOL_METADATA_OUT 294
-#define REDWAX_TOOL_FORMAT_OUT 295
-#define REDWAX_TOOL_JWKS_OUT 296
-#define REDWAX_TOOL_TEXT_OUT 297
-#define REDWAX_TOOL_NO_TEXT_OUT 298
-#define REDWAX_TOOL_SSH_PRIVATE_OUT 299
-#define REDWAX_TOOL_SSH_PUBLIC_OUT 300
-#define REDWAX_TOOL_SMIMEA_OUT 301
-#define REDWAX_TOOL_SSHFP_OUT 302
-#define REDWAX_TOOL_TLSA_OUT 303
-#define REDWAX_TOOL_USER_IN 304
-#define REDWAX_TOOL_USER_OUT 305
-#define REDWAX_TOOL_GROUP_IN 306
-#define REDWAX_TOOL_GROUP_OUT 307
+#define REDWAX_TOOL_PARAM_OUT 275
+#define REDWAX_TOOL_NO_PARAM_OUT 276
+#define REDWAX_TOOL_KEY_IN 277
+#define REDWAX_TOOL_NO_KEY_IN 278
+#define REDWAX_TOOL_KEY_OUT 279
+#define REDWAX_TOOL_NO_KEY_OUT 280
+#define REDWAX_TOOL_AUTO_OUT 281
+#define REDWAX_TOOL_NO_AUTO_OUT 282
+#define REDWAX_TOOL_FILTER_VERIFY_PARAM 283
+#define REDWAX_TOOL_SECRET_SUFFIX_IN 284
+#define REDWAX_TOOL_SECRET_SUFFIX_OUT 285
+#define REDWAX_TOOL_SECRET_TOKEN_IN 286
+#define REDWAX_TOOL_SECRET_TOKEN_OUT 287
+#define REDWAX_TOOL_LABEL_OUT 288
+#define REDWAX_TOOL_NSS_OUT 289
+#define REDWAX_TOOL_NSS_SLOT_OUT 290
+#define REDWAX_TOOL_DER_OUT 291
+#define REDWAX_TOOL_PEM_OUT 292
+#define REDWAX_TOOL_PKCS12_OUT 293
+#define REDWAX_TOOL_PKCS11_OUT 294
+#define REDWAX_TOOL_PKCS11_MODULE_OUT 295
+#define REDWAX_TOOL_METADATA_OUT 296
+#define REDWAX_TOOL_FORMAT_OUT 297
+#define REDWAX_TOOL_JWKS_OUT 298
+#define REDWAX_TOOL_TEXT_OUT 299
+#define REDWAX_TOOL_NO_TEXT_OUT 300
+#define REDWAX_TOOL_SSH_PRIVATE_OUT 301
+#define REDWAX_TOOL_SSH_PUBLIC_OUT 302
+#define REDWAX_TOOL_SMIMEA_OUT 303
+#define REDWAX_TOOL_SSHFP_OUT 304
+#define REDWAX_TOOL_TLSA_OUT 305
+#define REDWAX_TOOL_USER_IN 306
+#define REDWAX_TOOL_USER_OUT 307
+#define REDWAX_TOOL_GROUP_IN 308
+#define REDWAX_TOOL_GROUP_OUT 309
 
 #define REDWAX_EXIT_OK 0
 #define REDWAX_EXIT_INIT 1
@@ -268,6 +270,10 @@
         "  --crl-out\t\t\tInclude certificate revocation lists in the output." },
     { "no-crl-out", REDWAX_TOOL_NO_CRL_OUT, 0,
         "  --no-crl-out\t\t\tExclude certificate revocation lists from the output." },
+    { "parameter-out", REDWAX_TOOL_PARAM_OUT, 0,
+        "  --parameter-out\t\t\tInclude key parameters in the output." },
+    { "no-parameter-out", REDWAX_TOOL_NO_PARAM_OUT, 0,
+        "  --no-parameter-out\t\t\tExclude key parameters from the output." },
     { "key-in", REDWAX_TOOL_KEY_IN, 0,
         "  --key-in\t\t\tRead private keys in the input. This will trigger a\n\t\t\t\tlogin attempt if needed." },
     { "no-key-in", REDWAX_TOOL_NO_KEY_IN, 0,
@@ -2077,6 +2083,20 @@
     return APR_SUCCESS;
 }
 
+static apr_status_t redwax_set_param_out(redwax_tool_t *r)
+{
+    r->param_out = 1;
+
+    return APR_SUCCESS;
+}
+
+static apr_status_t redwax_set_no_param_out(redwax_tool_t *r)
+{
+    r->param_out = 0;
+
+    return APR_SUCCESS;
+}
+
 static apr_status_t redwax_set_key_out(redwax_tool_t *r)
 {
     r->key_out = 1;
@@ -2503,6 +2523,14 @@
         }
         case REDWAX_TOOL_NO_CRL_OUT: {
             redwax_set_no_crl_out(r);
+            break;
+        }
+        case REDWAX_TOOL_PARAM_OUT: {
+            redwax_set_param_out(r);
+            break;
+        }
+        case REDWAX_TOOL_NO_PARAM_OUT: {
+            redwax_set_no_param_out(r);
             break;
         }
         case REDWAX_TOOL_KEY_OUT: {

Modified: redwax-tool/trunk/redwax-tool.h
==============================================================================
--- redwax-tool/trunk/redwax-tool.h	(original)
+++ redwax-tool/trunk/redwax-tool.h	Tue Jul 18 16:27:53 2023
@@ -103,6 +103,7 @@
     int root_out;
     int trust_out;
     int crl_out;
+    int param_out;
     int key_in;
     int key_out;
     int auto_out;

Modified: redwax-tool/trunk/redwax_openssl.c
==============================================================================
--- redwax-tool/trunk/redwax_openssl.c	(original)
+++ redwax-tool/trunk/redwax_openssl.c	Tue Jul 18 16:27:53 2023
@@ -2238,6 +2238,7 @@
 #endif
 
             if ((r->text && !EVP_PKEY_print_private(bio, pkey, 0, NULL)) ||
+                (r->param_out && !PEM_write_bio_Parameters(bio, pkey)) ||
                     !PEM_write_bio_PKCS8_PRIV_KEY_INFO(bio, p8inf)) {
 
                 redwax_openssl_print_errors(r);



More information about the rt-commit mailing list