gpg symmetric encryption not working as expected

2

How am I supposed to use gpg to symmetrically encrypt a file? When I run gpg --symmetric filename, then it prompts me for passwords as expected, and generates a filename.gpg file. However, when I run gpg -d filename.gpg, it returns

gpg: CAST5 encrypted data
gpg: encrypted with 1 passphrase
SECRET DATA HERE
gpg: WARNING: message was not integrity protected

without asking for the password

gatoatigrado

Posted 2011-06-06T23:26:34.807

Reputation: 1 075

Answers

3

Recent versions of GnuPG come with a helper program gpg-agent, which handles the key and password operations and acts as a password cache. It could be that gpg-agent has cached the password you just entered.

To flush the cache, use either:

  • echo reloadagent | gpg-connect-agent

  • send SIGHUP: pkill -HUP -U $USER gpg-agent

user1686

Posted 2011-06-06T23:26:34.807

Reputation: 283 655

When encrypting is there a way to tell gpg not to cache passwords? – nullUser – 2014-01-08T23:07:12.400

2@nullUser: It's always done by gpg-agent, so you can set very low cache-ttl's in ~/.gnupg/gpg-agent.conf. – user1686 – 2014-01-09T12:32:10.020