summaryrefslogtreecommitdiffstats
path: root/scd/app.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2003-10-21 19:12:50 +0200
committerWerner Koch <wk@gnupg.org>2003-10-21 19:12:50 +0200
commit21be16dba911a3ebe530e37f3479690798cc8a01 (patch)
tree1e3bf026522ea34274d702b8d39968334ea3329c /scd/app.c
parent* card-util.c (card_edit): New command "passwd". Add logic to (diff)
downloadgnupg2-21be16dba911a3ebe530e37f3479690798cc8a01.tar.xz
gnupg2-21be16dba911a3ebe530e37f3479690798cc8a01.zip
* command.c (cmd_checkpin): New.
(register_commands): Add command CHECKPIN. * app.c (app_check_pin): New. * app-openpgp.c (check_against_given_fingerprint): New. Factored out that code elsewhere. (do_check_pin): New.
Diffstat (limited to 'scd/app.c')
-rw-r--r--scd/app.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/scd/app.c b/scd/app.c
index 5b0340b89..1f142ea32 100644
--- a/scd/app.c
+++ b/scd/app.c
@@ -295,6 +295,29 @@ app_change_pin (APP app, CTRL ctrl, const char *chvnostr, int reset_mode,
}
+/* Perform a VERIFY operation without doing anything lese. This may
+ be used to initialze a the PION cache for long lasting other
+ operations. Its use is highly application dependent. */
+int
+app_check_pin (APP app, const char *keyidstr,
+ int (*pincb)(void*, const char *, char **),
+ void *pincb_arg)
+{
+ int rc;
+
+ if (!app || !keyidstr || !*keyidstr || !pincb)
+ return gpg_error (GPG_ERR_INV_VALUE);
+ if (!app->initialized)
+ return gpg_error (GPG_ERR_CARD_NOT_INITIALIZED);
+ if (!app->fnc.check_pin)
+ return gpg_error (GPG_ERR_UNSUPPORTED_OPERATION);
+ rc = app->fnc.check_pin (app, keyidstr, pincb, pincb_arg);
+ if (opt.verbose)
+ log_info ("operation check_pin result: %s\n", gpg_strerror (rc));
+ return rc;
+}
+
+