aboutsummaryrefslogtreecommitdiffstats
path: root/g10/call-agent.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2018-03-01 18:03:23 +0000
committerWerner Koch <[email protected]>2018-03-01 18:03:23 +0000
commitfd595c9d3642dba437fbe0f6e25d7aaaae095f94 (patch)
tree86372f98479b23ad7ad23069145222c31796a641 /g10/call-agent.c
parentgpgconf, w32: Allow UNC paths (diff)
downloadgnupg-fd595c9d3642dba437fbe0f6e25d7aaaae095f94.tar.gz
gnupg-fd595c9d3642dba437fbe0f6e25d7aaaae095f94.zip
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 <[email protected]> Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'g10/call-agent.c')
-rw-r--r--g10/call-agent.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/g10/call-agent.c b/g10/call-agent.c
index 545b2448a..f29e1b131 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);