aboutsummaryrefslogtreecommitdiffstats
path: root/scd/app.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2005-02-22 17:29:07 +0000
committerWerner Koch <[email protected]>2005-02-22 17:29:07 +0000
commit8c77433de9a208d6ffb03aa482b6a5fe6bcfd4f3 (patch)
tree8de4c34ea77d997d628c23a06494a790565a1897 /scd/app.c
parent2005-02-19 Moritz Schulte <[email protected]> (diff)
downloadgnupg-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.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/scd/app.c b/scd/app.c
index 55fb5861e..fad4eba55 100644
--- a/scd/app.c
+++ b/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)