diff options
author | NIIBE Yutaka <[email protected]> | 2023-03-17 06:20:42 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2023-03-17 06:20:42 +0000 |
commit | 18a4002eab7f4265b2fdcf877714b8095db89722 (patch) | |
tree | 8a1c016d5e18e6ba709c2f688c869dfa7e58aca1 | |
parent | tkd: sorted out entities and initialize PKCS#11 on demand. (diff) | |
download | gnupg-18a4002eab7f4265b2fdcf877714b8095db89722.tar.gz gnupg-18a4002eab7f4265b2fdcf877714b8095db89722.zip |
tkd: Implement READKEY, returning canon SEXP.
Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r-- | tkd/pkcs11.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tkd/pkcs11.c b/tkd/pkcs11.c index da147ae5a..968c86454 100644 --- a/tkd/pkcs11.c +++ b/tkd/pkcs11.c @@ -1323,6 +1323,8 @@ tkd_readkey (ctrl_t ctrl, assuan_context_t ctx, const char *keygrip) struct key *k; struct cryptoki *ck = ck_instance; unsigned long r; + unsigned char *pk; + size_t pklen; (void)ctrl; (void)ctx; @@ -1338,6 +1340,15 @@ tkd_readkey (ctrl_t ctrl, assuan_context_t ctx, const char *keygrip) if (r) return gpg_error (GPG_ERR_NO_SECKEY); + pklen = gcry_sexp_sprint (k->pubkey, GCRYSEXP_FMT_CANON, NULL, 0); + pk = xtrymalloc (pklen); + if (!pk) + { + return gpg_error_from_syserror (); + } + gcry_sexp_sprint (k->pubkey, GCRYSEXP_FMT_CANON, pk, pklen); + err = assuan_send_data (ctx, pk, pklen); + xfree (pk); return err; } |