I want to work with gpg
-encrypted files using Emacs, and would like to be able to enter the passphrase for each encrypted file only once per Emacs session.
I used to be able to do this by setting the variable epa-file-cache-passphrase-for-symmetric-encryption
to t
, but this no longer works. The explanation can be found in the last line of the documentation for the variable epa-file-cache-passphrase-for-symmetric-encryption
:
(defcustom epa-file-cache-passphrase-for-symmetric-encryption nil
"If non-nil, cache passphrase for symmetric encryption.
For security reasons, this option is turned off by default and
not recommended to use. Instead, consider using gpg-agent which
does the same job in a safer way. See Info node `(epa) Caching
Passphrases' for more information.
Note that this option has no effect if you use GnuPG 2.0."
:type 'boolean
:group 'epa-file)
After a recent system update, the gpg
in my system is now version 2.1.8, which renders epa-file-cache-passphrase-for-symmetric-encryption
ineffective.
The references mentioned in the documentation above lead to a page that just tells you, again, to use gpg-agent
, but says nothing about how to do it. I have not been able to find clear instructions on how to set up gpg-agent
for the use-case I described at the beginning of this post. Any help would be appreciated.
FWIW, ps
tells me that /usr/bin/gpg-agent --supervised
is indeed running. What else must I do to get it to cache the passphrases I enter when working with *.gpg
files?
Also, the value of my epg-gpg-program
variable is /usr/bin/gpg
, which refers to the installed version 2.1.8 instance of gpg
mentioned earlier.
The versions of Emacs I am using are 26.0.50 and 27.0.50. For both cases, the version of the epa
package is 23.1.
pinentry
package per this answer: