Emacs encrypts/decrypts .gpg files automatically. But recently I have lost the ability to decrypt files encrypted by the Linux gpg tool and vice versa.

I use:

  • passphrase symmetric encryption
  • gnupg 1.4.11
  • emacs
  • Debian sid

Decrypting using gpg (encrypted by emacs) gives:

gpg: decryption failed: bad key

Decrypting using emacs (encrypted by gpg) gives:

epa-file--find-file-not-found-function: Opening input file: Decryption failed,

Any idea how to avoid this?

  • Are you sure gpg and emacs are using the same key? – Kevin Jan 4 '12 at 21:29
  • Not enough info about what is happening in your system for the question to be answerable and useful for others. – imz -- Ivan Zakharyaschev Jan 4 '12 at 23:12
  • I use passphrase for symmetric encription – user331426 Jan 5 '12 at 8:31

You might be missing a suitable pinentry program and unfortunately Emacs' output is less than helpful.

On a RedHat system your might want try installing the pinentry-gtk package and see if everything works.

| improve this answer | |

This is an old question, but I recently had the same problem, so I'll post my solution anyway.

In my case the file was encrypted using a GnuPG key. At one point in a long-lived session, Emacs lost the ability to decrypt the file giving me the same error message as as in the original post:

epa-file--find-file-not-found-function: Opening input file: Decryption failed

I found that if I killed any related 'gpg-agent' process running in the background, Emacs then regained the ability to decrypt the file (after asking for the passphrase again).

| improve this answer | |

The issue was in this (in Russian) solution which manipulates with input method. At present time it affects on passphrase during encryption/decryption.

| improve this answer | |
  • 3
    Could you explain the issue in your post? Both for the benefit of people who don't speak Russian, and to prepare for the inevitable link rot. Thanks. – Gilles 'SO- stop being evil' Jan 11 '12 at 23:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.