1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-23 10:29:58 +01:00

scd:nks: Add support of KEYGRIP for do_readcert.

* scd/app-nks.c (do_readcert): Support KEYGRIP.

--

GnuPG-bug-id: 5150
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
(cherry picked from commit 4020cd9d656264bec5e7fb5e45c5e06eff8656c3)
This commit is contained in:
NIIBE Yutaka 2020-12-10 10:27:21 +09:00 committed by Werner Koch
parent ea7234d2f5
commit 1f2823e0be
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -1136,6 +1136,24 @@ do_readcert (app_t app, const char *certid,
*cert = NULL;
*certlen = 0;
/* Handle the case with KEYGRIP. */
if (strlen (certid) == 40)
{
char keygripstr[2*KEYGRIP_LEN+1];
i = -1;
err = iterate_over_filelist (app, certid, 0, keygripstr, &i);
if (err)
return err;
if (filelist[i].iskeypair > 0)
fid = filelist[i].iskeypair;
else
fid = filelist[i].fid;
return readcert_from_ef (app, fid, cert, certlen);
}
if (!strncmp (certid, "NKS-NKS3.", 9))
nks_app_id = NKS_APP_NKS;
else if (!strncmp (certid, "NKS-ESIGN.", 10))