diff options
author | NIIBE Yutaka <[email protected]> | 2020-10-26 04:49:23 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2022-08-16 08:56:46 +0000 |
commit | 27ae89db6e6901a8fd6f1dce50a25c1a4b845086 (patch) | |
tree | 735d27bcf815a7c60db88e365a361d66ddcf70be | |
parent | common: In private key mode write "Key:" always last in name-value. (diff) | |
download | gnupg-27ae89db6e6901a8fd6f1dce50a25c1a4b845086.tar.gz gnupg-27ae89db6e6901a8fd6f1dce50a25c1a4b845086.zip |
gpg: Fix detecting OpenPGP card by serialno.
* g10/card-util.c (get_info_for_key_operation): Use ->apptype to
determine card's APP.
(current_card_status): Even if its SERIALNO is not like OpenPGP card,
it's OpenPGP card when app says so.
--
GnuPG-bug-id: 5100
Signed-off-by: NIIBE Yutaka <[email protected]>
Backported-from-master: 157f1de64e437cecd75335e9f4077ba9835e3da0
-rw-r--r-- | g10/card-util.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/g10/card-util.c b/g10/card-util.c index 242fa94dd..29b5d1984 100644 --- a/g10/card-util.c +++ b/g10/card-util.c @@ -382,7 +382,9 @@ current_card_status (ctrl_t ctrl, estream_t fp, || strlen (info.serialno) != 32 ) { const char *name1, *name2; - if (info.apptype && !strcmp (info.apptype, "NKS")) + if (info.apptype && !strcmp (info.apptype, "openpgp")) + goto openpgp; + else if (info.apptype && !strcmp (info.apptype, "NKS")) { name1 = "netkey"; name2 = "NetKey"; @@ -422,7 +424,7 @@ current_card_status (ctrl_t ctrl, estream_t fp, xfree (pk); return; } - + openpgp: if (!serialno) ; else if (strlen (info.serialno)+1 > serialnobuflen) @@ -1236,8 +1238,7 @@ get_info_for_key_operation (struct agent_card_info_s *info) memset (info, 0, sizeof *info); rc = agent_scd_getattr ("SERIALNO", info); - if (rc || !info->serialno || strncmp (info->serialno, "D27600012401", 12) - || strlen (info->serialno) != 32 ) + if (rc || !info->apptype || strcmp (info->apptype, "openpgp")) { log_error (_("key operation not possible: %s\n"), rc ? gpg_strerror (rc) : _("not an OpenPGP card")); |