diff options
author | Werner Koch <[email protected]> | 2005-02-22 17:29:07 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2005-02-22 17:29:07 +0000 |
commit | 8c77433de9a208d6ffb03aa482b6a5fe6bcfd4f3 (patch) | |
tree | 8de4c34ea77d997d628c23a06494a790565a1897 /scd/app.c | |
parent | 2005-02-19 Moritz Schulte <[email protected]> (diff) | |
download | gnupg-8c77433de9a208d6ffb03aa482b6a5fe6bcfd4f3.tar.gz gnupg-8c77433de9a208d6ffb03aa482b6a5fe6bcfd4f3.zip |
* 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.
Diffstat (limited to 'scd/app.c')
-rw-r--r-- | scd/app.c | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -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) |