[git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.5-5-gfd595c9
by Werner Koch
cvs at cvs.gnupg.org
Thu Mar 1 19:09:30 CET 2018
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".
The branch, STABLE-BRANCH-2-2 has been updated
via fd595c9d3642dba437fbe0f6e25d7aaaae095f94 (commit)
from e43844c3b0b9ec93b7f2a88752bcd6b6244aacfb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit fd595c9d3642dba437fbe0f6e25d7aaaae095f94
Author: Werner Koch <wk at gnupg.org>
Date: Thu Mar 1 19:03:23 2018 +0100
gpg: Print the keygrip with --card-status
* g10/call-agent.h (agent_card_info_s): Add fields grp1, grp2 and
grp3.
* g10/call-agent.c (unhexify_fpr): Allow for space as delimiter.
(learn_status_cb): Parse KEYPARIINFO int the grpX fields.
* g10/card-util.c (print_keygrip): New.
(current_card_status): Print "grp:" records or with --with-keygrip a
human readable keygrip.
--
Suggested-by: Peter Lebbing <peter at digitalbrains.com>
Signed-off-by: Werner Koch <wk at gnupg.org>
diff --git a/g10/call-agent.c b/g10/call-agent.c
index 545b244..f29e1b1 100644
--- a/g10/call-agent.c
+++ b/g10/call-agent.c
@@ -381,10 +381,11 @@ unhexify_fpr (const char *hexstr, unsigned char *fpr)
for (s=hexstr, n=0; hexdigitp (s); s++, n++)
;
- if (*s || (n != 40))
+ if ((*s && *s != ' ') || (n != 40))
return 0; /* no fingerprint (invalid or wrong length). */
for (s=hexstr, n=0; *s; s += 2, n++)
fpr[n] = xtoi_2 (s);
+
return 1; /* okay */
}
@@ -625,6 +626,24 @@ learn_status_cb (void *opaque, const char *line)
else if (no == 3)
parm->fpr3time = strtoul (line, NULL, 10);
}
+ else if (keywordlen == 11 && !memcmp (keyword, "KEYPAIRINFO", keywordlen))
+ {
+ const char *hexgrp = line;
+ int no;
+
+ while (*line && !spacep (line))
+ line++;
+ while (spacep (line))
+ line++;
+ if (strncmp (line, "OPENPGP.", 8))
+ ;
+ else if ((no = atoi (line+8)) == 1)
+ unhexify_fpr (hexgrp, parm->grp1);
+ else if (no == 2)
+ unhexify_fpr (hexgrp, parm->grp2);
+ else if (no == 3)
+ unhexify_fpr (hexgrp, parm->grp3);
+ }
else if (keywordlen == 6 && !memcmp (keyword, "CA-FPR", keywordlen))
{
int no = atoi (line);
diff --git a/g10/call-agent.h b/g10/call-agent.h
index f45b64d..53775c5 100644
--- a/g10/call-agent.h
+++ b/g10/call-agent.h
@@ -47,6 +47,9 @@ struct agent_card_info_s
u32 fpr1time;
u32 fpr2time;
u32 fpr3time;
+ char grp1[20]; /* The keygrip for OPENPGP.1 */
+ char grp2[20]; /* The keygrip for OPENPGP.2 */
+ char grp3[20]; /* The keygrip for OPENPGP.3 */
unsigned long sig_counter;
int chv1_cached; /* True if a PIN is not required for each
signing. Note that the gpg-agent might cache
diff --git a/g10/card-util.c b/g10/card-util.c
index 759dde8..bda4e83 100644
--- a/g10/card-util.c
+++ b/g10/card-util.c
@@ -264,6 +264,21 @@ print_sha1_fpr_colon (estream_t fp, const unsigned char *fpr)
static void
+print_keygrip (estream_t fp, const unsigned char *grp)
+{
+ int i;
+
+ if (opt.with_keygrip)
+ {
+ tty_fprintf (fp, " keygrip ....: ");
+ for (i=0; i < 20 ; i++, grp++)
+ es_fprintf (fp, "%02X", *grp);
+ tty_fprintf (fp, "\n");
+ }
+}
+
+
+static void
print_name (estream_t fp, const char *text, const char *name)
{
tty_fprintf (fp, "%s", text);
@@ -517,6 +532,11 @@ current_card_status (ctrl_t ctrl, estream_t fp,
es_fprintf (fp, "fprtime:%lu:%lu:%lu:\n",
(unsigned long)info.fpr1time, (unsigned long)info.fpr2time,
(unsigned long)info.fpr3time);
+ es_fputs ("grp:", fp);
+ print_sha1_fpr_colon (fp, info.grp1);
+ print_sha1_fpr_colon (fp, info.grp2);
+ print_sha1_fpr_colon (fp, info.grp3);
+ es_putc ('\n', fp);
}
else
{
@@ -593,18 +613,27 @@ current_card_status (ctrl_t ctrl, estream_t fp,
tty_fprintf (fp, "Signature key ....:");
print_sha1_fpr (fp, info.fpr1valid? info.fpr1:NULL);
if (info.fpr1valid && info.fpr1time)
- tty_fprintf (fp, " created ....: %s\n",
- isotimestamp (info.fpr1time));
+ {
+ tty_fprintf (fp, " created ....: %s\n",
+ isotimestamp (info.fpr1time));
+ print_keygrip (fp, info.grp1);
+ }
tty_fprintf (fp, "Encryption key....:");
print_sha1_fpr (fp, info.fpr2valid? info.fpr2:NULL);
if (info.fpr2valid && info.fpr2time)
- tty_fprintf (fp, " created ....: %s\n",
- isotimestamp (info.fpr2time));
+ {
+ tty_fprintf (fp, " created ....: %s\n",
+ isotimestamp (info.fpr2time));
+ print_keygrip (fp, info.grp2);
+ }
tty_fprintf (fp, "Authentication key:");
print_sha1_fpr (fp, info.fpr3valid? info.fpr3:NULL);
if (info.fpr3valid && info.fpr3time)
- tty_fprintf (fp, " created ....: %s\n",
- isotimestamp (info.fpr3time));
+ {
+ tty_fprintf (fp, " created ....: %s\n",
+ isotimestamp (info.fpr3time));
+ print_keygrip (fp, info.grp2);
+ }
tty_fprintf (fp, "General key info..: ");
thefpr = (info.fpr1valid? info.fpr1 : info.fpr2valid? info.fpr2 :
-----------------------------------------------------------------------
Summary of changes:
g10/call-agent.c | 21 ++++++++++++++++++++-
g10/call-agent.h | 3 +++
g10/card-util.c | 41 +++++++++++++++++++++++++++++++++++------
3 files changed, 58 insertions(+), 7 deletions(-)
hooks/post-receive
--
The GNU Privacy Guard
http://git.gnupg.org
More information about the Gnupg-commits
mailing list