Subject: bug#45916: 28.0.50; Inconsistent EasyPG behaviour when encrypting .gpg files

From: Pankaj Jangid <[email-masked]>
Date: Sat, 16 Jan 2021 15:10:44 +0530

> 1. emacs -Q
> 2. eval ‘(defvar epg-pinentry-mode 'loopback)’
> 3. C-c C-f ~/x.gpg RET
> 4. Write some text
> 5. C-x C-s ; this prompts for selecting key and saves using that.
> 6. C-x k ;
> 7. C-c C-f ~/x.gpg RET ; open again
> 8. make some changes
> 9. C-x C-s ; asks for passphrase for symmetric key encryption

> Behaviour in step 5 and 9 should be same. _Or_ if the file was already
> saved encrypted with a public-key then it should use the same key again.

More info (it is fixed after invoking ‘M-x epa-file-select-keys’)

Now I opened ~/x.gpg again and invoke ‘M-x epa-file-select-keys’ and
selected the desired public key and saved (C-x C-s). Now it saved the
file using the public key.

I see that, when I open a .gpg file it sets a buffer-local variable
‘epa-file-encrypt-to’. Which makes it automatically use the public key
because the value of ‘epa-file-select-keys’ is nil (default).

And after I invoked ‘M-x epa-file-select-keys’, it is consistently
behaving as described in the manuals i.e. Step (9) is not asking for
symmetric key encryption passphrase any more.

Probably the ‘epa-file-encrypt-to’ was not being set earlier after
opening a .gpg file.

My question is - does invoking ‘M-x epa-file-select-keys’ save the
information somewhere on the filesystem? Only after invoking this the
behaviour got fixed.