mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
gpg: Add pinentry-mode feature.
* g10/gpg.c: Include shareddefs.h. (main): Add option --pinentry-mode. * g10/options.h (struct opt): Add field pinentry_mode. * g10/passphrase.c: Include shareddefs.h. (have_static_passphrase): Take care of loopback pinentry_mode. (read_passphrase_from_fd): Ditto. (get_static_passphrase): New. (passphrase_to_dek_ext): Factor some code out to ... (emit_status_need_passphrase): new. * g10/call-agent.c (start_agent): Send the pinentry mode. (default_inq_cb): Take care of the PASSPHRASE inquiry. Return a proper error code. (agent_pksign): Add args keyid, mainkeyid and pubkey_algo. (agent_pkdecrypt): Ditto. * g10/pubkey-enc.c (get_it): Pass new args. * g10/sign.c (do_sign): Pass new args. * g10/call-agent.c (struct default_inq_parm_s): New. Change all similar structs to reference this one. Change all users and inquire callback to use this struct, instead of NULL or some undefined but not used structs. This change will help to eventually get rid of global variables. -- This new features allows to use gpg without a Pinentry. As a prerequisite the agent must be configured to allow the loopback pinentry mode (option --allow-loopback-pinentry). For example gpg2 --pinentry-mode=loopback FILE.gpg may be used to decrypt FILE.gpg while entering the passphrase on the tty. If batch is used, --passphrase et al. may be used, if --command-fd is used, the passphrase may be provided by another process. Note that there are no try-again prompts in case of a bad passphrase.
This commit is contained in:
parent
84de484bc3
commit
21feecd48f
10 changed files with 301 additions and 81 deletions
20
doc/gpg.texi
20
doc/gpg.texi
|
@ -2611,6 +2611,26 @@ Note that this passphrase is only used if the option @option{--batch}
|
|||
has also been given. This is different from @command{gpg}.
|
||||
@end ifclear
|
||||
|
||||
@ifset gpgtwoone
|
||||
@item --pinentry-mode @code{mode}
|
||||
@opindex pinentry-mode
|
||||
Set the pinentry mode to @code{mode}. Allowed values for @code{mode}
|
||||
are:
|
||||
@table @asis
|
||||
@item default
|
||||
Use the default of the agent, which is @code{ask}.
|
||||
@item ask
|
||||
Force the use of the Pinentry.
|
||||
@item cancel
|
||||
Emulate use of Pinentry's cancel button.
|
||||
@item error
|
||||
Return a Pinentry error (``No Pinentry'').
|
||||
@item loopback
|
||||
Redirect Pinentry queries to the caller. Note that in contrast to
|
||||
Pinentry the user is not prompted again if he enters a bad password.
|
||||
@end table
|
||||
@end ifset
|
||||
|
||||
@item --command-fd @code{n}
|
||||
@opindex command-fd
|
||||
This is a replacement for the deprecated shared-memory IPC mode.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue