Re: pgg-encrypt is a pain in the neck

From:

Richard Stallman

Subject:

Re: pgg-encrypt is a pain in the neck

Date:

Tue, 02 Jan 2007 11:37:38 -0500

Do you mean "the gpg agent directions" is one I wrote? You asked me to
write a documentation of gpg-agent usage for the Emacs Manual, and I
sent the following to you privately.
Yes, that is the text I mean. Would someone please install this
in the Message mode manual?
Some Emacs commands internally call GnuPG (the @command{gpg} command)
to perform data encryption, and in certain cases (decrypting or
signing for example), @command{gpg} requires user's passphrase.
Currently the recommended way to supply your passphrase to
@command{gpg} is to use the @command{gpg-agent} program.
To use @command{gpg-agent} in Emacs, you need to run the following
command from the shell before starting Emacs.
@example
eval `gpg-agent --daemon`
@end example
This will invoke @command{gpg-agent} and set the environment variable
@code{GPG_AGENT_INFO} to allow @command{gpg} to communicate with it.
It might be good idea to put this command in your @file{.xsession} or
@file{.bash_profile}. @xref{Invoking GPG-AGENT, , , gnupg, Using the
GNU Privacy Guard}.
Once your @command{gpg-agent} is set up, it will ask you for a
passphrase as needed for @command{gpg}. Under the X Window System,
you will see a new passphrase input dialog appear. The dialog is
provided by PIN Entry (the @command{pinentry} command), and as of
version 0.7.2, @command{pinentry} cannot cooperate with Emacs on a
single tty. So, if you are using a text console, you may need to put
a passphrase into gpg-agent's cache beforehand. The following command
does the trick.
@example
gpg --use-agent --sign < /dev/null > /dev/null
@end example
The Lisp variable @code{pgg-gpg-use-agent} controls whether to use
@command{gpg-agent}. See also @xref{Caching passphrase, , , pgg, The
PGG Manual}.