1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-11-10 21:38:50 +01:00

tkd: Implement READKEY, returning canon SEXP.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2023-03-17 15:20:42 +09:00
parent 22be07a08c
commit 18a4002eab
No known key found for this signature in database
GPG Key ID: 640114AF89DE6054

View File

@ -1323,6 +1323,8 @@ tkd_readkey (ctrl_t ctrl, assuan_context_t ctx, const char *keygrip)
struct key *k; struct key *k;
struct cryptoki *ck = ck_instance; struct cryptoki *ck = ck_instance;
unsigned long r; unsigned long r;
unsigned char *pk;
size_t pklen;
(void)ctrl; (void)ctrl;
(void)ctx; (void)ctx;
@ -1338,6 +1340,15 @@ tkd_readkey (ctrl_t ctrl, assuan_context_t ctx, const char *keygrip)
if (r) if (r)
return gpg_error (GPG_ERR_NO_SECKEY); 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; return err;
} }