aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/gpg.texi7
-rw-r--r--g10/gpg.c2
-rw-r--r--g10/keydb.h2
-rw-r--r--g10/keyedit.c2
-rw-r--r--g10/keyid.c4
-rw-r--r--g10/keylist.c8
-rw-r--r--g10/options.h1
7 files changed, 22 insertions, 4 deletions
diff --git a/doc/gpg.texi b/doc/gpg.texi
index e0b0039a9..d0da83706 100644
--- a/doc/gpg.texi
+++ b/doc/gpg.texi
@@ -1096,6 +1096,13 @@ give the opposite meaning. The options are:
see @option{--attribute-fd} for the appropriate way to get photo data
for scripts and other frontends.
+ @item show-usage
+ @opindex list-options:show-usage
+ Show usage information for keys and subkeys in the standard key
+ listing. This is a list of letters indicating the allowed usage for a
+ key (@code{E}=encryption, @code{S}=signing, @code{C}=certification,
+ @code{A}=authentication). Defaults to no.
+
@item show-policy-urls
@opindex list-options:show-policy-urls
Show policy URLs in the @option{--list-sigs} or @option{--check-sigs}
diff --git a/g10/gpg.c b/g10/gpg.c
index 1f840c6ed..666e970ec 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -1793,6 +1793,8 @@ parse_list_options(char *str)
{
{"show-photos",LIST_SHOW_PHOTOS,NULL,
N_("display photo IDs during key listings")},
+ {"show-usage",LIST_SHOW_USAGE,NULL,
+ N_("show key usage information during key listings")},
{"show-policy-urls",LIST_SHOW_POLICY_URLS,NULL,
N_("show policy URLs during signature listings")},
{"show-notations",LIST_SHOW_NOTATIONS,NULL,
diff --git a/g10/keydb.h b/g10/keydb.h
index 0cf6ca110..23d0bcc26 100644
--- a/g10/keydb.h
+++ b/g10/keydb.h
@@ -282,7 +282,7 @@ const char *datestr_from_sig( PKT_signature *sig );
const char *expirestr_from_pk( PKT_public_key *pk );
const char *expirestr_from_sig( PKT_signature *sig );
const char *revokestr_from_pk( PKT_public_key *pk );
-const char *usagestr_from_pk( PKT_public_key *pk );
+const char *usagestr_from_pk (PKT_public_key *pk, int fill);
const char *colon_strtime (u32 t);
const char *colon_datestr_from_pk (PKT_public_key *pk);
const char *colon_datestr_from_sig (PKT_signature *sig);
diff --git a/g10/keyedit.c b/g10/keyedit.c
index c5f02f7b6..77bd37f58 100644
--- a/g10/keyedit.c
+++ b/g10/keyedit.c
@@ -2991,7 +2991,7 @@ show_key_with_all_names (estream_t fp,
else
tty_fprintf (fp, _("expires: %s"), expirestr_from_pk (pk));
tty_fprintf (fp, " ");
- tty_fprintf (fp, _("usage: %s"), usagestr_from_pk (pk));
+ tty_fprintf (fp, _("usage: %s"), usagestr_from_pk (pk, 1));
tty_fprintf (fp, "\n");
if (pk->seckey_info
diff --git a/g10/keyid.c b/g10/keyid.c
index 6ce6f3277..94900bd73 100644
--- a/g10/keyid.c
+++ b/g10/keyid.c
@@ -629,7 +629,7 @@ revokestr_from_pk( PKT_public_key *pk )
const char *
-usagestr_from_pk( PKT_public_key *pk )
+usagestr_from_pk (PKT_public_key *pk, int fill)
{
static char buffer[10];
int i = 0;
@@ -647,7 +647,7 @@ usagestr_from_pk( PKT_public_key *pk )
if ( (use & PUBKEY_USAGE_AUTH) )
buffer[i++] = 'A';
- while (i < 4)
+ while (fill && i < 4)
buffer[i++] = ' ';
buffer[i] = 0;
diff --git a/g10/keylist.c b/g10/keylist.c
index 7d9fe230c..364947528 100644
--- a/g10/keylist.c
+++ b/g10/keylist.c
@@ -834,6 +834,10 @@ list_keyblock_print (KBNODE keyblock, int secret, int fpr, void *opaque)
pubkey_string (pk, pkstrbuf, sizeof pkstrbuf),
keystr_from_pk (pk), datestr_from_pk (pk));
+ if ((opt.list_options & LIST_SHOW_USAGE))
+ {
+ es_fprintf (es_stdout, " [%s]", usagestr_from_pk (pk, 0));
+ }
if (pk->flags.revoked)
{
es_fprintf (es_stdout, " [");
@@ -973,6 +977,10 @@ list_keyblock_print (KBNODE keyblock, int secret, int fpr, void *opaque)
xfree (curve);
}
+ if ((opt.list_options & LIST_SHOW_USAGE))
+ {
+ es_fprintf (es_stdout, " [%s]", usagestr_from_pk (pk2, 0));
+ }
if (pk2->flags.revoked)
{
es_fprintf (es_stdout, " [");
diff --git a/g10/options.h b/g10/options.h
index 0a604f9af..266b3e9c6 100644
--- a/g10/options.h
+++ b/g10/options.h
@@ -349,6 +349,7 @@ EXTERN_UNLESS_MAIN_MODULE int memory_stat_debug_mode;
#define LIST_SHOW_KEYRING (1<<8)
#define LIST_SHOW_SIG_EXPIRE (1<<9)
#define LIST_SHOW_SIG_SUBPACKETS (1<<10)
+#define LIST_SHOW_USAGE (1<<11)
#define VERIFY_SHOW_PHOTOS (1<<0)
#define VERIFY_SHOW_POLICY_URLS (1<<1)