1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

scd: Support automatic card selection for READCERT with keygrip.

* scd/command.c (cmd_readcert): Select by KEYGRIP.

--

GnuPG-bug-id: 6003
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2022-05-24 16:14:30 +09:00
parent 1b0c4c2778
commit ea97683d58

View File

@ -639,6 +639,7 @@ cmd_readcert (assuan_context_t ctx, char *line)
unsigned char *cert; unsigned char *cert;
size_t ncert; size_t ncert;
card_t card; card_t card;
const char *keygrip = NULL;
if ((rc = open_card (ctrl))) if ((rc = open_card (ctrl)))
return rc; return rc;
@ -647,7 +648,10 @@ cmd_readcert (assuan_context_t ctx, char *line)
if (!line) if (!line)
return gpg_error_from_syserror (); return gpg_error_from_syserror ();
card = card_get (ctrl, NULL); if (strlen (line) == 40)
keygrip = line;
card = card_get (ctrl, keygrip);
if (!card) if (!card)
{ {
xfree (line); xfree (line);