Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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.

share|improve this answer
up vote 1 down vote accepted

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

share|improve this answer
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 Jan 11 '12 at 23:56

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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