mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
* app-openpgp.c (app_local_s): New field PK.
(do_deinit, do_genkey, app_openpgp_storekey): Clear it. (get_public_key, send_keypair_info): New. (do_learn_status): Send KEYPAIR info * app-common.h (app_ctx_t): Add function pointer READKEY. * app.c (app_readkey): New. * command.c (cmd_readkey): Use READKEY function if possible.
This commit is contained in:
parent
823eaefb0b
commit
8c77433de9
5 changed files with 317 additions and 14 deletions
26
scd/app.c
26
scd/app.c
|
@ -263,6 +263,32 @@ app_readcert (app_t app, const char *certid,
|
|||
}
|
||||
|
||||
|
||||
/* Read the key with ID KEYID. On success a canonical encoded
|
||||
S-expression with the public key will get stored at PK and its
|
||||
length (for assertions) at PKLEN; the caller must release that
|
||||
buffer. On error NULL will be stored at PK and PKLEN and an error
|
||||
code returned.
|
||||
|
||||
This function might not be supported by all applications. */
|
||||
int
|
||||
app_readkey (app_t app, const char *keyid, unsigned char **pk, size_t *pklen)
|
||||
{
|
||||
if (pk)
|
||||
*pk = NULL;
|
||||
if (pklen)
|
||||
*pklen = 0;
|
||||
|
||||
if (!app || !keyid || !pk || !pklen)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
if (!app->initialized)
|
||||
return gpg_error (GPG_ERR_CARD_NOT_INITIALIZED);
|
||||
if (!app->fnc.readkey)
|
||||
return gpg_error (GPG_ERR_UNSUPPORTED_OPERATION);
|
||||
|
||||
return app->fnc.readkey (app, keyid, pk, pklen);
|
||||
}
|
||||
|
||||
|
||||
/* Perform a GETATTR operation. */
|
||||
int
|
||||
app_getattr (APP app, CTRL ctrl, const char *name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue