summaryrefslogtreecommitdiffstats
path: root/scd
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2022-05-24 09:14:30 +0200
committerNIIBE Yutaka <gniibe@fsij.org>2022-05-24 09:17:01 +0200
commitea97683d58205363d48fd41ef5559926be46681e (patch)
treedce5c4788f1cf1d648d6a76d8ad02180aea36ce7 /scd
parentagent: Fix a bug accessing after release when opt.verbose. (diff)
downloadgnupg2-ea97683d58205363d48fd41ef5559926be46681e.tar.xz
gnupg2-ea97683d58205363d48fd41ef5559926be46681e.zip
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>
Diffstat (limited to 'scd')
-rw-r--r--scd/command.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/scd/command.c b/scd/command.c
index bc2e1f979..e73228f3d 100644
--- a/scd/command.c
+++ b/scd/command.c
@@ -639,6 +639,7 @@ cmd_readcert (assuan_context_t ctx, char *line)
unsigned char *cert;
size_t ncert;
card_t card;
+ const char *keygrip = NULL;
if ((rc = open_card (ctrl)))
return rc;
@@ -647,7 +648,10 @@ cmd_readcert (assuan_context_t ctx, char *line)
if (!line)
return gpg_error_from_syserror ();
- card = card_get (ctrl, NULL);
+ if (strlen (line) == 40)
+ keygrip = line;
+
+ card = card_get (ctrl, keygrip);
if (!card)
{
xfree (line);