diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2016-05-12 17:13:50 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2016-05-13 02:21:56 +0100 |
commit | f47e5647750d4443cbdd7fc2311f838f0f103112 (patch) | |
tree | 92b3abfe76db550135fb47f980ea7a2608cd4f35 | |
parent | 3ec8a1cfd8e06e2308fc318d8071aa7b5ddda146 (diff) |
Fix signer option and support format SMIME.
Fix -signer option in smime utility to output signer certificates
when verifying.
Add support for format SMIME for -inform and -outform with cms and
smime utilities.
PR#4215
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
-rw-r--r-- | apps/apps.h | 1 | ||||
-rw-r--r-- | apps/cms.c | 8 | ||||
-rw-r--r-- | apps/opt.c | 4 | ||||
-rw-r--r-- | apps/smime.c | 10 |
4 files changed, 13 insertions, 10 deletions
diff --git a/apps/apps.h b/apps/apps.h index fc96d81e1c..4b11dbca83 100644 --- a/apps/apps.h +++ b/apps/apps.h @@ -410,6 +410,7 @@ typedef struct string_int_pair_st { # define OPT_FMT_HTTP (1L << 9) # define OPT_FMT_PVK (1L << 10) # define OPT_FMT_PDE (OPT_FMT_PEMDER | OPT_FMT_ENGINE) +# define OPT_FMT_PDS (OPT_FMT_PEMDER | OPT_FMT_SMIME) # define OPT_FMT_ANY ( \ OPT_FMT_PEMDER | OPT_FMT_PKCS12 | OPT_FMT_SMIME | \ OPT_FMT_ENGINE | OPT_FMT_MSBLOB | OPT_FMT_NETSCAPE | \ diff --git a/apps/cms.c b/apps/cms.c index 7bc40d5d2f..84cea9d1b3 100644 --- a/apps/cms.c +++ b/apps/cms.c @@ -134,8 +134,8 @@ OPTIONS cms_options[] = { " cert.pem... recipient certs for encryption\n"}, {OPT_HELP_STR, 1, '-', "Valid options are:\n"}, {"help", OPT_HELP, '-', "Display this summary"}, - {"inform", OPT_INFORM, 'F', "Input format SMIME (default), PEM or DER"}, - {"outform", OPT_OUTFORM, 'F', + {"inform", OPT_INFORM, 'c', "Input format SMIME (default), PEM or DER"}, + {"outform", OPT_OUTFORM, 'c', "Output format SMIME (default), PEM or DER"}, {"in", OPT_IN, '<', "Input file"}, {"out", OPT_OUT, '>', "Output file"}, @@ -278,11 +278,11 @@ int cms_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_PDS, &informat)) goto opthelp; break; case OPT_OUTFORM: - if (!opt_format(opt_arg(), OPT_FMT_PEMDER, &outformat)) + if (!opt_format(opt_arg(), OPT_FMT_PDS, &outformat)) goto opthelp; break; case OPT_OUT: diff --git a/apps/opt.c b/apps/opt.c index 82ac5a804e..84e8661a93 100644 --- a/apps/opt.c +++ b/apps/opt.c @@ -180,7 +180,7 @@ char *opt_init(int ac, char **av, const OPTIONS *o) switch (i) { case 0: case '-': case '/': case '<': case '>': case 'E': case 'F': case 'M': case 'U': case 'f': case 'l': case 'n': case 'p': case 's': - case 'u': + case 'u': case 'c': break; default: assert(0); @@ -756,10 +756,12 @@ int opt_next(void) return -1; } break; + case 'c': case 'E': case 'F': case 'f': if (opt_format(arg, + o->valtype == 'c' ? OPT_FMT_PDS : o->valtype == 'E' ? OPT_FMT_PDE : o->valtype == 'F' ? OPT_FMT_PEMDER : OPT_FMT_ANY, &ival)) diff --git a/apps/smime.c b/apps/smime.c index 3257a23396..cd68e55196 100644 --- a/apps/smime.c +++ b/apps/smime.c @@ -115,15 +115,15 @@ OPTIONS smime_options[] = { {"noattr", OPT_NOATTR, '-', "Don't include any signed attributes"}, {"binary", OPT_BINARY, '-', "Don't translate message to text"}, {"certfile", OPT_CERTFILE, '<', "Other certificates file"}, - {"signer", OPT_SIGNER, '<', "Signer certificate file"}, + {"signer", OPT_SIGNER, 's', "Signer certificate file"}, {"recip", OPT_RECIP, '<', "Recipient certificate file for decryption"}, {"in", OPT_IN, '<', "Input file"}, - {"inform", OPT_INFORM, 'F', "Input format SMIME (default), PEM or DER"}, + {"inform", OPT_INFORM, 'c', "Input format SMIME (default), PEM or DER"}, {"inkey", OPT_INKEY, '<', "Input private key (if not signer or recipient)"}, {"keyform", OPT_KEYFORM, 'f', "Input private key format (PEM or ENGINE)"}, {"out", OPT_OUT, '>', "Output file"}, - {"outform", OPT_OUTFORM, 'F', + {"outform", OPT_OUTFORM, 'c', "Output format SMIME (default), PEM or DER"}, {"content", OPT_CONTENT, '<', "Supply or override content for detached signature"}, @@ -200,14 +200,14 @@ int smime_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_PDS, &informat)) goto opthelp; break; case OPT_IN: infile = opt_arg(); break; case OPT_OUTFORM: - if (!opt_format(opt_arg(), OPT_FMT_PEMDER, &outformat)) + if (!opt_format(opt_arg(), OPT_FMT_PDS, &outformat)) goto opthelp; break; case OPT_OUT: |