summaryrefslogtreecommitdiffstats
path: root/apps/pkcs7.c
diff options
context:
space:
mode:
authorRaul Ferrando <rferrandop@protonmail.com>2022-02-15 16:02:41 +0100
committerPauli <pauli@openssl.org>2022-02-24 11:21:06 +1100
commit632e8be2b570959dc3781c6956171e7e49f1aa58 (patch)
treeb2914bbf34cf5dc0bdbf13745adb64ef3e4b968d /apps/pkcs7.c
parent42659159f4d4a8c16a0e9b089d40a5831b60cbb6 (diff)
Add -quiet option to pkcs7 for -print_certs
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17708)
Diffstat (limited to 'apps/pkcs7.c')
-rw-r--r--apps/pkcs7.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/apps/pkcs7.c b/apps/pkcs7.c
index ac2dec152a..a95ea25377 100644
--- a/apps/pkcs7.c
+++ b/apps/pkcs7.c
@@ -23,8 +23,8 @@
typedef enum OPTION_choice {
OPT_COMMON,
OPT_INFORM, OPT_OUTFORM, OPT_IN, OPT_OUT, OPT_NOOUT,
- OPT_TEXT, OPT_PRINT, OPT_PRINT_CERTS, OPT_ENGINE,
- OPT_PROV_ENUM
+ OPT_TEXT, OPT_PRINT, OPT_PRINT_CERTS, OPT_QUIET,
+ OPT_ENGINE, OPT_PROV_ENUM
} OPTION_CHOICE;
const OPTIONS pkcs7_options[] = {
@@ -46,6 +46,8 @@ const OPTIONS pkcs7_options[] = {
{"print", OPT_PRINT, '-', "Print out all fields of the PKCS7 structure"},
{"print_certs", OPT_PRINT_CERTS, '-',
"Print_certs print any certs or crl in the input"},
+ {"quiet", OPT_QUIET, '-',
+ "When used with -print_certs, it produces a cleaner output"},
OPT_PROV_OPTIONS,
{NULL}
@@ -58,7 +60,7 @@ int pkcs7_main(int argc, char **argv)
BIO *in = NULL, *out = NULL;
int informat = FORMAT_PEM, outformat = FORMAT_PEM;
char *infile = NULL, *outfile = NULL, *prog;
- int i, print_certs = 0, text = 0, noout = 0, p7_print = 0, ret = 1;
+ int i, print_certs = 0, text = 0, noout = 0, p7_print = 0, quiet = 0, ret = 1;
OPTION_CHOICE o;
OSSL_LIB_CTX *libctx = app_get0_libctx();
@@ -100,6 +102,9 @@ int pkcs7_main(int argc, char **argv)
case OPT_PRINT_CERTS:
print_certs = 1;
break;
+ case OPT_QUIET:
+ quiet = 1;
+ break;
case OPT_ENGINE:
e = setup_engine(opt_arg(), 0);
break;
@@ -171,7 +176,7 @@ int pkcs7_main(int argc, char **argv)
x = sk_X509_value(certs, i);
if (text)
X509_print(out, x);
- else
+ else if (!quiet)
dump_cert_text(out, x);
if (!noout)