* findkey.c (unprotect): Show an error message for a bad passphrase.

This commit is contained in:
Werner Koch 2002-02-18 22:39:26 +00:00
parent 5dac4711f9
commit 2585114325
2 changed files with 6 additions and 1 deletions

View File

@ -1,5 +1,7 @@
2002-02-18 Werner Koch <wk@gnupg.org>
* findkey.c (unprotect): Show an error message for a bad passphrase.
* command.c (cmd_marktrusted): Implemented.
* trustlist.c (agent_marktrusted): New.
(open_list): Add APPEND arg.

View File

@ -39,6 +39,7 @@ unprotect (unsigned char **keybuf, const unsigned char *grip)
size_t resultlen;
int tries = 0;
char hexgrip[40+1];
const char *errtext;
for (i=0; i < 20; i++)
sprintf (hexgrip+2*i, "%02X", grip[i]);
@ -67,9 +68,10 @@ unprotect (unsigned char **keybuf, const unsigned char *grip)
pi->max_digits = 8;
pi->max_tries = 3;
errtext = NULL;
do
{
rc = agent_askpin (NULL, NULL, pi);
rc = agent_askpin (NULL, errtext, pi);
if (!rc)
{
rc = agent_unprotect (*keybuf, pi->pin, &result, &resultlen);
@ -82,6 +84,7 @@ unprotect (unsigned char **keybuf, const unsigned char *grip)
return 0;
}
}
errtext = pi->min_digits? trans ("Bad PIN") : trans ("Bad Passphrase");
}
while ((rc == GNUPG_Bad_Passphrase || rc == GNUPG_Bad_PIN)
&& tries++ < 3);