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:
parent
22be07a08c
commit
18a4002eab
11
tkd/pkcs11.c
11
tkd/pkcs11.c
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user