mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
* passphrase.c (ask_passphrase): Add optional promptid arg.
Changed all callers. * cardglue.c (pin_cb): Use it here, so the machine interface can tell whether the Admin PIN is requested. * cardglue.c (agent_scd_checkpin): New. * misc.c (openpgp_pk_algo_usage): Added AUTH usage. * app-openpgp.c (check_against_given_fingerprint): New. Factored out that code elsewhere. (do_check_pin): New. * card-util.c (card_edit): New command "passwd". Add logic to check the PIN in advance. (card_status): Add new args to return the serial number. Changed all callers.
This commit is contained in:
parent
b194ed0e0a
commit
441aeb85f2
14 changed files with 252 additions and 120 deletions
|
@ -508,13 +508,16 @@ pin_cb (void *opaque, const char *info, char **retstr)
|
|||
{
|
||||
char *value;
|
||||
int canceled;
|
||||
int isadmin = (info && strstr (info, "dmin"));
|
||||
|
||||
|
||||
*retstr = NULL;
|
||||
log_debug ("asking for PIN '%s'\n", info);
|
||||
|
||||
value = ask_passphrase (info,
|
||||
info && strstr (info, "dmin")?
|
||||
_("Enter Admin PIN: ") : _("Enter PIN: "),
|
||||
isadmin? "passphrase.adminpin.ask"
|
||||
: "passphrase.pin.ask",
|
||||
isadmin? _("Enter Admin PIN: ") : _("Enter PIN: "),
|
||||
&canceled);
|
||||
if (!value && canceled)
|
||||
return -1;
|
||||
|
@ -645,7 +648,6 @@ agent_scd_pkdecrypt (const char *serialno,
|
|||
const unsigned char *indata, size_t indatalen,
|
||||
unsigned char **r_buf, size_t *r_buflen)
|
||||
{
|
||||
|
||||
APP app;
|
||||
|
||||
*r_buf = NULL;
|
||||
|
@ -680,3 +682,18 @@ agent_scd_change_pin (int chvno)
|
|||
pin_cb, NULL);
|
||||
}
|
||||
|
||||
/* Perform a CHECKPIN operation. SERIALNO should be the seriial
|
||||
number of the card - optioanlly followed by the fingerprint;
|
||||
however the fingerprint is ignored here. */
|
||||
int
|
||||
agent_scd_checkpin (const char *serialnobuf)
|
||||
{
|
||||
APP app;
|
||||
|
||||
app = current_app? current_app : open_card ();
|
||||
if (!app)
|
||||
return gpg_error (GPG_ERR_CARD);
|
||||
|
||||
return app->fnc.check_pin (app, serialnobuf, pin_cb, NULL);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue