diff options
| author | Werner Koch <[email protected]> | 2019-02-21 11:43:07 +0000 |
|---|---|---|
| committer | Werner Koch <[email protected]> | 2019-02-21 11:43:07 +0000 |
| commit | 7317aeb3f448c98dcfa9c04f49b9a69d81c26776 (patch) | |
| tree | cef6aa41dc512016a7233f1426cd5807e6402e19 /tools/gpg-card-tool.c | |
| parent | scd: Extend KEYPAIRINFO by key usage info. (diff) | |
| download | gnupg-7317aeb3f448c98dcfa9c04f49b9a69d81c26776.tar.gz gnupg-7317aeb3f448c98dcfa9c04f49b9a69d81c26776.zip | |
card: Print usage info for each key.
* tools/card-call-scd.c (learn_status_cb): Handle extended
KEYPARIRINFO.
* tools/card-tool.h (struct key_info_s): Add field 'usage'.
* tools/gpg-card-tool.c (list_one_kinfo): Show usage flags.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'tools/gpg-card-tool.c')
| -rw-r--r-- | tools/gpg-card-tool.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tools/gpg-card-tool.c b/tools/gpg-card-tool.c index a13a6bdaf..eb723d7ab 100644 --- a/tools/gpg-card-tool.c +++ b/tools/gpg-card-tool.c @@ -621,6 +621,7 @@ list_one_kinfo (key_info_t firstkinfo, key_info_t kinfo, estream_t fp) key_info_t ki; const char *s; gcry_sexp_t s_pkey; + int any; if (firstkinfo && kinfo) { @@ -630,8 +631,25 @@ list_one_kinfo (key_info_t firstkinfo, key_info_t kinfo, estream_t fp) tty_fprintf (fp, "[none]\n"); goto leave; } + print_keygrip (fp, kinfo->grip); - tty_fprintf (fp, " keyref .....: %s\n", kinfo->keyref); + tty_fprintf (fp, " keyref .....: %s", kinfo->keyref); + if (kinfo->usage) + { + any = 0; + tty_fprintf (fp, " ("); + if ((kinfo->usage & GCRY_PK_USAGE_SIGN)) + { tty_fprintf (fp, "sign"); any=1; } + if ((kinfo->usage & GCRY_PK_USAGE_CERT)) + { tty_fprintf (fp, "%scert", any?",":""); any=1; } + if ((kinfo->usage & GCRY_PK_USAGE_AUTH)) + { tty_fprintf (fp, "%sauth", any?",":""); any=1; } + if ((kinfo->usage & GCRY_PK_USAGE_ENCR)) + { tty_fprintf (fp, "%sencr", any?",":""); any=1; } + tty_fprintf (fp, ")"); + } + tty_fprintf (fp, "\n"); + if (!scd_readkey (kinfo->keyref, &s_pkey)) { char *tmp = pubkey_algo_string (s_pkey); |
