summaryrefslogtreecommitdiffstats
path: root/sm/gpgsm.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2021-04-20 09:37:56 +0200
committerWerner Koch <wk@gnupg.org>2021-04-20 09:37:56 +0200
commit51419d63415ae2aa029f8829099b6789b264edc5 (patch)
treeaf217258af2d08d952531bead97d39b058da5fbf /sm/gpgsm.c
parentbuild: Fix build problems on macOS for gpgsm tests and gpg-card. (diff)
downloadgnupg2-51419d63415ae2aa029f8829099b6789b264edc5.tar.xz
gnupg2-51419d63415ae2aa029f8829099b6789b264edc5.zip
sm: New command --show-certs
* sm/keylist.c (do_show_certs): New. (gpgsm_show_certs): New. * sm/gpgsm.c (aShowCerts): New. (opts): Add --show-certs. (main): Call gpgsm_show_certs. -- I have been using libksba test programs for countless times to look at certificates and I always wanted to add such a feature to gpgsm. This is simply much more convenient. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'sm/gpgsm.c')
-rw-r--r--sm/gpgsm.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sm/gpgsm.c b/sm/gpgsm.c
index e292aa160..ca30358ec 100644
--- a/sm/gpgsm.c
+++ b/sm/gpgsm.c
@@ -96,6 +96,7 @@ enum cmd_and_opt_values {
aDumpChain,
aDumpSecretKeys,
aDumpExternalKeys,
+ aShowCerts,
aKeydbClearSomeCertFlags,
aFingerprint,
@@ -252,6 +253,7 @@ static gpgrt_opt_t opts[] = {
ARGPARSE_c (aGPGConfList, "gpgconf-list", "@"),
ARGPARSE_c (aGPGConfTest, "gpgconf-test", "@"),
+ ARGPARSE_c (aShowCerts, "show-certs", "@"),
ARGPARSE_c (aDumpKeys, "dump-cert", "@"),
ARGPARSE_c (aDumpKeys, "dump-keys", "@"),
ARGPARSE_c (aDumpChain, "dump-chain", "@"),
@@ -1212,6 +1214,7 @@ main ( int argc, char **argv)
case aExportSecretKeyP12:
case aExportSecretKeyP8:
case aExportSecretKeyRaw:
+ case aShowCerts:
case aDumpKeys:
case aDumpChain:
case aDumpExternalKeys:
@@ -2121,6 +2124,15 @@ main ( int argc, char **argv)
}
break;
+ case aShowCerts:
+ {
+ estream_t fp;
+
+ fp = open_es_fwrite (opt.outfile?opt.outfile:"-");
+ gpgsm_show_certs (&ctrl, argc, argv, fp);
+ es_fclose (fp);
+ }
+ break;
case aKeygen: /* Generate a key; well kind of. */
{