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, 2012 at 21:29
  • Not enough info about what is happening in your system for the question to be answerable and useful for others. Jan 4, 2012 at 23:12
  • I use passphrase for symmetric encription
    – user331426
    Jan 5, 2012 at 8:31

3 Answers 3


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).


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.


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

  • 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. Jan 11, 2012 at 23:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .