mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
Handle pinentry-mode=loopback.
When this mode is set an inquire will be sent to the client to retrieve the passphrase. This adds a new inquire keyword "NEW_PASSPHRASE" that the GENKEY and PASSWD commands use when generating a new key.
This commit is contained in:
parent
bea3b7c93f
commit
fb1cdd7b0e
5 changed files with 83 additions and 2 deletions
|
@ -304,6 +304,23 @@ agent_ask_new_passphrase (ctrl_t ctrl, const char *prompt,
|
|||
|
||||
*r_passphrase = NULL;
|
||||
|
||||
if (ctrl->pinentry_mode == PINENTRY_MODE_LOOPBACK)
|
||||
{
|
||||
size_t size;
|
||||
size_t len = 100;
|
||||
unsigned char *buffer;
|
||||
|
||||
err = pinentry_loopback(ctrl, "NEW_PASSPHRASE", &buffer, &size, len);
|
||||
if (err)
|
||||
xfree(buffer);
|
||||
else
|
||||
{
|
||||
buffer[size] = 0;
|
||||
*r_passphrase = buffer;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
pi = gcry_calloc_secure (2, sizeof (*pi) + 100);
|
||||
pi2 = pi + (sizeof *pi + 100);
|
||||
pi->max_length = 100;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue