mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
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@digitalbrains.com> Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
e43844c3b0
commit
fd595c9d36
3 changed files with 58 additions and 7 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue