Subject: bug#22941: 25.1.50; epa-list-secret-keys does not find gpg private keys

From: Daiki Ueno <[email-masked]>
Date: Thu, 10 Mar 2016 12:30:50 +0900

tag 22941 notabug
close 22941
stop

Iñigo Serna <[email-masked]> writes:

> Since a couple of months ago emacs 25.0.x (last tested as 2016/03/08
> from git master) can't open encrypted files (using symmetric keys), as
> epa can't find secret keys from gpg.
>
> This is the error message I get:
> """
> Error while decrypting with "gpg":
>
> gpg: encrypted with 2048-bit RSA key, ID C0ED9C8489B28C43, created 2016-01-12
>       "Iñigo Serna (XXX.YY) <[email-masked]>"
> gpg: decryption failed: No secret key
> """
>
> I use gpg (not gpg2) so I added '(setq epg-gpg-program "gpg")' to my
> configuration as new epa defaults to gpg2 when I've run "emacs -Q -nw".
>
> `epa-list-secret-keys` does not find any keys.
>
> This same configuration works ok with 24.5.1 (from Fedora 23 x86_64), and
> even `epa-list-secret-keys` shows the private keys correctly.

This behavior is intended, if the key was created with gpg2.  GnuPG 2.1
removed support for secring.gpg, which was used by pre-2.1 versions.
That is one of the reasons we switched the default to "gpg2".

See doc/whats-new-in-2.1.txt in GnuPG:

1.1 Removal of the secret keyring
─────────────────────────────────
[...]
  2.1.  However, any change to the private keys using the new /gpg/ will
  not show up when using pre-2.1 versions of GnuPG and vice versa.

Regards,
-- 
Daiki Ueno