aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2020-12-10 01:27:21 +0000
committerWerner Koch <[email protected]>2022-10-20 10:22:08 +0000
commit1f2823e0beee8567461d509ad6e59002718b4271 (patch)
tree74dc36b13f867bfd31c36827d1433861bfd03032
parentscd:nks: Factor out iteration over filelist. (diff)
downloadgnupg-1f2823e0beee8567461d509ad6e59002718b4271.tar.gz
gnupg-1f2823e0beee8567461d509ad6e59002718b4271.zip
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 <[email protected]> (cherry picked from commit 4020cd9d656264bec5e7fb5e45c5e06eff8656c3)
-rw-r--r--scd/app-nks.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/scd/app-nks.c b/scd/app-nks.c
index 529b1fe44..050d354b5 100644
--- a/scd/app-nks.c
+++ b/scd/app-nks.c
@@ -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))