aboutsummaryrefslogtreecommitdiffstats
path: root/g10
diff options
context:
space:
mode:
Diffstat (limited to 'g10')
-rw-r--r--g10/ChangeLog7
-rw-r--r--g10/gpg.c6
-rw-r--r--g10/keylist.c31
-rw-r--r--g10/options.h3
4 files changed, 42 insertions, 5 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index 36a49ba84..a4873fe53 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,10 @@
+2010-10-08 Werner Koch <[email protected]>
+
+ * gpg.c: Add option --with-keygrip.
+ * options.h (struct opt): Add WITH_KEYGRIP.
+ * keylist.c (list_keyblock_print, list_keyblock_colon): Implement
+ new option.
+
2010-10-06 Werner Koch <[email protected]>
* import.c (transfer_secret_keys): Ignore missing key parameters.
diff --git a/g10/gpg.c b/g10/gpg.c
index f553c6e16..c25c3ba18 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -166,6 +166,7 @@ enum cmd_and_opt_values
oNoAskCertLevel,
oFingerprint,
oWithFingerprint,
+ oWithKeygrip,
oAnswerYes,
oAnswerNo,
oKeyring,
@@ -669,6 +670,7 @@ static ARGPARSE_OPTS opts[] = {
ARGPARSE_s_n (oUtf8Strings, "utf8-strings", "@"),
ARGPARSE_s_n (oNoUtf8Strings, "no-utf8-strings", "@"),
ARGPARSE_s_n (oWithFingerprint, "with-fingerprint", "@"),
+ ARGPARSE_s_n (oWithKeygrip, "with-keygrip", "@"),
ARGPARSE_s_s (oDisableCipherAlgo, "disable-cipher-algo", "@"),
ARGPARSE_s_s (oDisablePubkeyAlgo, "disable-pubkey-algo", "@"),
ARGPARSE_s_n (oAllowNonSelfsignedUID, "allow-non-selfsigned-uid", "@"),
@@ -2279,6 +2281,10 @@ main (int argc, char **argv)
fpr_maybe_cmd = 1;
break;
+ case oWithKeygrip:
+ opt.with_keygrip = 1;
+ break;
+
case oSecretKeyring:
/* Ignore this old option. */
break;
diff --git a/g10/keylist.c b/g10/keylist.c
index 254513a76..d144afc39 100644
--- a/g10/keylist.c
+++ b/g10/keylist.c
@@ -822,6 +822,17 @@ list_keyblock_print (KBNODE keyblock, int secret, int fpr, void *opaque)
if (fpr)
print_fingerprint (pk, 0);
+ if (opt.with_keygrip)
+ {
+ char *p;
+
+ if (!hexkeygrip_from_pk (pk, &p))
+ {
+ es_fprintf (es_stdout, " Keygrip = %s\n", p);
+ xfree (p);
+ }
+ }
+
/* FIXME: Change this function to take a PK and ask the agent: */
/* if (secret) print_card_serialno (sk); */
@@ -919,6 +930,16 @@ list_keyblock_print (KBNODE keyblock, int secret, int fpr, void *opaque)
/* if (secret) */
/* print_card_serialno (sk2); */
}
+ if (opt.with_keygrip)
+ {
+ char *p;
+
+ if (!hexkeygrip_from_pk (pk2, &p))
+ {
+ es_fprintf (es_stdout, " Keygrip = %s\n", p);
+ xfree (p);
+ }
+ }
if (opt.with_key_data)
print_key_data (pk2);
}
@@ -1131,14 +1152,15 @@ list_keyblock_colon (KBNODE keyblock, int secret, int fpr)
print_revokers (pk);
if (fpr)
print_fingerprint (pk, 0);
- if (opt.with_key_data)
+ if (opt.with_key_data || opt.with_keygrip)
{
if (!hexkeygrip_from_pk (pk, &p))
{
es_fprintf (es_stdout, "grp:::::::::%s:\n", p);
xfree (p);
}
- print_key_data (pk);
+ if (opt.with_key_data)
+ print_key_data (pk);
}
for (kbctx = NULL; (node = walk_kbnode (keyblock, &kbctx, 0));)
@@ -1236,14 +1258,15 @@ list_keyblock_colon (KBNODE keyblock, int secret, int fpr)
es_putc ('\n', es_stdout);
if (fpr > 1)
print_fingerprint (pk2, 0);
- if (opt.with_key_data)
+ if (opt.with_key_data || opt.with_keygrip)
{
if (!hexkeygrip_from_pk (pk2, &p))
{
es_fprintf (es_stdout, "grp:::::::::%s:\n", p);
xfree (p);
}
- print_key_data (pk2);
+ if (opt.with_key_data)
+ print_key_data (pk2);
}
}
else if (opt.list_sigs && node->pkt->pkttype == PKT_SIGNATURE)
diff --git a/g10/options.h b/g10/options.h
index 968393257..499428e92 100644
--- a/g10/options.h
+++ b/g10/options.h
@@ -59,7 +59,8 @@ struct
int check_sigs; /* check key signatures */
int with_colons;
int with_key_data;
- int with_fingerprint; /* opt --with-fingerprint active */
+ int with_fingerprint; /* Option --with-fingerprint active. */
+ int with_keygrip; /* Option --with-keygrip active. */
int fingerprint; /* list fingerprints */
int list_sigs; /* list signatures */
int no_armor;