Search code examples
gnupg

gpg: decryption failed: Bad session key


I'm trying to decrypt a file using gpg and getting this error:

$ gpg --no-tty --batch --verbose --decrypt --passphrase foo file.enc
Version: GnuPG v1.4.11 (GNU/Linux)
gpg: armor header: 
gpg: CAST5 encrypted data
gpg: encrypted with 1 passphrase
gpg: decryption failed: Bad session key

I tried to reload the gpg agent, no luck:

$ gpgconf --reload gpg-agent

How to solve that?


Solution

  • For the record, if somebody will encounter this problem, too:

    The problem was, that the encryption was done using gpg version 1.4.11 and the decryption was using gpg version 2.0.22.

    After upgrading the encryption to gpg2 (2.0.17), everything worked fine.