You also have to
Explicitely enable loopback mode for pinentry in your
Configure epa to use loopback for pinentry.
Start the pinentry server in emacs,
1. Enable Emacs pinentry and loopback mode for gpg-agent
Put this in your ~/.gnupg/gpg-agent.conf:
Then tell gpg-agent to load this configuration ...
You do not say which OS nor version of emacs you have.
I solved yesterday exactly the same problem in OSX and emacs 25.1 using information from this link: http://colinxy.github.io/software-installation/2016/09/24/emacs25-easypg-issue.html
I ran these commands:
brew unlink gnupg2 gpg-agent dirmngr
brew uninstall gnupg2 gpg-agent dirmngr
brew install ...
Encryption using password + key
This does not save the password directly in the file but does something similar without any security risk and helps you achieve what you want.
You need to use asymmetric encryption so that your password is associated with an email ID in a keyring.
Save the below at the top of your .gpg file
-*- epa-file-encrypt-to: ("...
In this documentation, the options you might be interested in
Set the time a cache entry is valid to n seconds. The default is 600 seconds. Each time a cache entry is accessed, the entry’s timer is reset. To set an entry’s maximum lifetime, use max-cache-...
# -*- mode:org; epa-file-encrypt-to: ("arthur@ul___dt.com" "email@example.com") -*-
When a mail address is associated to several keys switch to the key ids. E.g. a call to epa-file-select-keys reveals key ids. The header line with fake key ids looks like:
# -*- mode:org; epa-file-encrypt-to: ("12345678ABCDEF00" "...
I cannot comment on Emacs 24, but here's how I solved this for Emacs 25:
By default epa in Emacs 25 uses gpg2 (GnuPG 2.x). According to the Epa manual, caching with gpg2 requires gpg-agent.
For some reason, I had to enable pinentry in the minibuffer, see: Enabling minibuffer pinentry with Emacs 25 and GnuPG 2.1 on Ubuntu Xenial
The documentation string ...
How can you be sure that GNOME is not caching the passphrase? If you are starting emacs in non-terminal mode, and if it is not asking for passphrase, you must have checked the option for "Automatically unlock whenever I am logged in".
You can start seahorse from the GNOME search bar or from the terminal and go to your Gnome2 Key Storage and search for gpg2 ...
For gpg version < 2, caching can be from emacs or the gpg-agent
To disable caching from emacs, set epa-file-cache-passphrase-for-symmetric-encryption to nil if it is not nil in emacs config file
(setq epa-file-cache-passphrase-for-symmetric-encryption nil)
To disable caching by gpg-agent, add
default-cache-ttl 0 to gpg config file located at ~/.gnupg/...
When you open a encrypted file, Emacs automatically replaces the contents of it's buffer with a decrypted version of it. Though doc-view, and for that matter pdf-view as well, does not care for the actual buffer content, but rather uses the buffer's file-name with various programs, in your case ghostscript, in order to produce images of the PDF pages. ...
Not really an Emacs related problem but, one of the solution could be:
create a SUM of your .org file,
then create an encrypted signature of the SUM file, named SUM.sign,
and finally, share the 3 files whenever necessary
That way, your .org file will stay the same.