From dd9589740d54b81c5aef6c7f5fa28f68f23fb27f Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Mon, 8 Feb 2016 15:06:48 +0000 Subject: [PATCH] Fix engine key support in utilities. Reviewed-by: Rich Salz --- apps/ca.c | 2 +- apps/dgst.c | 10 +++++----- apps/dsa.c | 5 ++--- apps/pkey.c | 4 ++-- apps/rsa.c | 2 +- apps/rsautl.c | 2 +- apps/x509.c | 4 ++-- 7 files changed, 14 insertions(+), 15 deletions(-) diff --git a/apps/ca.c b/apps/ca.c index 8658b2d82f..9a1b69f68d 100644 --- a/apps/ca.c +++ b/apps/ca.c @@ -219,7 +219,7 @@ OPTIONS ca_options[] = { {"days", OPT_DAYS, 'p', "Number of days to certify the cert for"}, {"md", OPT_MD, 's', "md to use; one of md2, md5, sha or sha1"}, {"policy", OPT_POLICY, 's', "The CA 'policy' to support"}, - {"keyfile", OPT_KEYFILE, '<', "Private key file"}, + {"keyfile", OPT_KEYFILE, 's', "Private key"}, {"keyform", OPT_KEYFORM, 'f', "Private key file format (PEM or ENGINE)"}, {"passin", OPT_PASSIN, 's'}, {"key", OPT_KEY, 's', "Key to decode the private key if it is encrypted"}, diff --git a/apps/dgst.c b/apps/dgst.c index 7fa535197e..cab848516b 100644 --- a/apps/dgst.c +++ b/apps/dgst.c @@ -95,11 +95,11 @@ OPTIONS dgst_options[] = { "Use file(s) containing random data to seed RNG or an EGD sock"}, {"out", OPT_OUT, '>', "Output to filename rather than stdout"}, {"passin", OPT_PASSIN, 's', "Input file pass phrase source"}, - {"sign", OPT_SIGN, '<', "Sign digest using private key in file"}, - {"verify", OPT_VERIFY, '<', - "Verify a signature using public key in file"}, - {"prverify", OPT_PRVERIFY, '<', - "Verify a signature using private key in file"}, + {"sign", OPT_SIGN, 's', "Sign digest using private key"}, + {"verify", OPT_VERIFY, 's', + "Verify a signature using public key"}, + {"prverify", OPT_PRVERIFY, 's', + "Verify a signature using private key"}, {"signature", OPT_SIGNATURE, '<', "File with signature to verify"}, {"keyform", OPT_KEYFORM, 'f', "Key file format (PEM or ENGINE)"}, {"hex", OPT_HEX, '-', "Print as hex dump"}, diff --git a/apps/dsa.c b/apps/dsa.c index 992d4e4ff9..ebb5775a8b 100644 --- a/apps/dsa.c +++ b/apps/dsa.c @@ -82,7 +82,7 @@ OPTIONS dsa_options[] = { {"help", OPT_HELP, '-', "Display this summary"}, {"inform", OPT_INFORM, 'F', "Input format, DER PEM PVK"}, {"outform", OPT_OUTFORM, 'F', "Output format, DER PEM PVK"}, - {"in", OPT_IN, '<', "Input file"}, + {"in", OPT_IN, 's', "Input key"}, {"out", OPT_OUT, '>', "Output file"}, {"noout", OPT_NOOUT, '-', "Don't print key out"}, {"text", OPT_TEXT, '-', "Print the key in text"}, @@ -130,8 +130,7 @@ int dsa_main(int argc, char **argv) ret = 0; goto end; case OPT_INFORM: - if (!opt_format - (opt_arg(), OPT_FMT_PEMDER | OPT_FMT_PVK, &informat)) + if (!opt_format(opt_arg(), OPT_FMT_ANY, &informat)) goto opthelp; break; case OPT_IN: diff --git a/apps/pkey.c b/apps/pkey.c index 40db6f57f9..6f5ecf0ce6 100644 --- a/apps/pkey.c +++ b/apps/pkey.c @@ -75,7 +75,7 @@ OPTIONS pkey_options[] = { {"outform", OPT_OUTFORM, 'F', "Output format (DER or PEM)"}, {"passin", OPT_PASSIN, 's', "Input file pass phrase source"}, {"passout", OPT_PASSOUT, 's', "Output file pass phrase source"}, - {"in", OPT_IN, '<', "Input file"}, + {"in", OPT_IN, 's', "Input key"}, {"out", OPT_OUT, '>', "Output file"}, {"pubin", OPT_PUBIN, '-', "Read public key from input (default is private key)"}, @@ -116,7 +116,7 @@ int pkey_main(int argc, char **argv) ret = 0; goto end; case OPT_INFORM: - if (!opt_format(opt_arg(), OPT_FMT_PEMDER, &informat)) + if (!opt_format(opt_arg(), OPT_FMT_ANY, &informat)) goto opthelp; break; case OPT_OUTFORM: diff --git a/apps/rsa.c b/apps/rsa.c index cafa6f4617..810713faa8 100644 --- a/apps/rsa.c +++ b/apps/rsa.c @@ -130,7 +130,7 @@ OPTIONS rsa_options[] = { {"help", OPT_HELP, '-', "Display this summary"}, {"inform", OPT_INFORM, 'f', "Input format, one of DER NET PEM"}, {"outform", OPT_OUTFORM, 'f', "Output format, one of DER NET PEM PVK"}, - {"in", OPT_IN, '<', "Input file"}, + {"in", OPT_IN, 's', "Input file"}, {"out", OPT_OUT, '>', "Output file"}, {"pubin", OPT_PUBIN, '-', "Expect a public key in input file"}, {"pubout", OPT_PUBOUT, '-', "Output a public key"}, diff --git a/apps/rsautl.c b/apps/rsautl.c index b576ca0b76..beb03eb8dc 100644 --- a/apps/rsautl.c +++ b/apps/rsautl.c @@ -86,7 +86,7 @@ OPTIONS rsautl_options[] = { {"help", OPT_HELP, '-', "Display this summary"}, {"in", OPT_IN, '<', "Input file"}, {"out", OPT_OUT, '>', "Output file"}, - {"inkey", OPT_INKEY, '<', "Input key"}, + {"inkey", OPT_INKEY, 's', "Input key"}, {"keyform", OPT_KEYFORM, 'E', "Private key format - default PEM"}, {"pubin", OPT_PUBIN, '-', "Input is an RSA public"}, {"certin", OPT_CERTIN, '-', "Input is a cert carrying an RSA public key"}, diff --git a/apps/x509.c b/apps/x509.c index 5d6bb9679a..831d59db44 100644 --- a/apps/x509.c +++ b/apps/x509.c @@ -160,7 +160,7 @@ OPTIONS x509_options[] = { "Output a certification request object"}, {"req", OPT_REQ, '-', "Input is a certificate request, sign and output"}, {"CA", OPT_CA, '<', "Set the CA certificate, must be PEM format"}, - {"CAkey", OPT_CAKEY, '<', + {"CAkey", OPT_CAKEY, 's', "The CA key, must be PEM format; if not in CAfile"}, {"CAcreateserial", OPT_CACREATESERIAL, '-', "Create serial number file if it does not exist"}, @@ -272,7 +272,7 @@ int x509_main(int argc, char **argv) goto opthelp; break; case OPT_CAKEYFORM: - if (!opt_format(opt_arg(), OPT_FMT_PEMDER, &CAkeyformat)) + if (!opt_format(opt_arg(), OPT_FMT_ANY, &CAkeyformat)) goto opthelp; break; case OPT_OUT: -- 2.25.1