Skip to content

Instantly share code, notes, and snippets.

@ameliaikeda
Last active August 29, 2015 14:16
Show Gist options
  • Save ameliaikeda/348126613ca433cae868 to your computer and use it in GitHub Desktop.
Save ameliaikeda/348126613ca433cae868 to your computer and use it in GitHub Desktop.
From acb90d7c078f4554c20b55547ff8578bf8b468fd Mon Sep 17 00:00:00 2001
From: Amelia Ikeda <[email protected]>
Date: Wed, 11 Mar 2015 12:11:04 +0000
Subject: [PATCH] Allow using -iter count with pkcs8
---
apps/pkcs8.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/apps/pkcs8.c b/apps/pkcs8.c
index 5099e18..0c173b9 100644
--- a/apps/pkcs8.c
+++ b/apps/pkcs8.c
@@ -150,7 +150,11 @@ int MAIN(int argc, char **argv)
topk8 = 1;
else if (!strcmp(*args, "-noiter"))
iter = 1;
- else if (!strcmp(*args, "-nocrypt"))
+ else if (!strcmp(*args, "-iter")) {
+ if (!args[1]) goto bad;
+ iter = atoi(*(++args));
+ if (iter <= 0) goto bad;
+ } else if (!strcmp(*args, "-nocrypt"))
nocrypt = 1;
else if (!strcmp(*args, "-nooct"))
p8_broken = PKCS8_NO_OCTET;
@@ -211,6 +215,7 @@ int MAIN(int argc, char **argv)
BIO_printf(bio_err,
"-nsdb use (nonstandard) DSA Netscape DB format\n");
BIO_printf(bio_err, "-noiter use 1 as iteration count\n");
+ BIO_printf(bio_err, "-iter count use count as iteration count\n");
BIO_printf(bio_err,
"-nocrypt use or expect unencrypted private key\n");
BIO_printf(bio_err,
--
1.9.5 (Apple Git-50.3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment