I've been using enigmail for over a year without issue, and today it doesn't work.
I found the following interesting fact:
gpg --decrypt something.gpg # this works
gpg2 --decrypt something.gpg # this fails
So something is broken with gpg version 2 on my machine.
This led me to see that:
gpg --list-secret-keys # reads from ~/.gnupg/secring.gpg
gpg2 --list-secret-keys # reads from ~/.gnupg/pubring.gpg (pubring?!)
This seems to be the root of the problem... of course gpg2
can't find the secret key because it's looking in the wrong file.
How could my gpg2
fail when my gpg
works fine? I don't see any options to specify where the secret keys are read from.
Anybody have any ideas?
Response to @grawity:
Thanks, I appreciate your help. I ran strace
, and I see what you are talking about.
However, even after gpg2 --import ...
I am seeing no difference in behavior. I can only get it to work if I reboot (without starting gpg-agent), run gpg2 --import ...
, then run gpg2 --decrypt ...
. After that sequence, thunderbird + enigmail also behaves nicely. However, after 15 minutes or so (my guess is the password I entered to decrypt has expired), then gpg-agent
is back to its old behavior. This sequence is repeatable.
So here is some output if it helps clear anything up:
output of gpg2 -K
:
/home/<username>/.gnupg/pubring.gpg
---------------------------------
sec rsa4096/AAAAAAAA <date> [SC]
uid [ultimate] <description of me>
ssb rsa4096/BBBBBBBB <date> [E]
output of gpg-connect-agent
> keyinfo --list
S KEYINFO <keygrip associated with AAAAAAAA> D - - - P - - -
S KEYINFO <keygrip associated with BBBBBBBB> D - - - P - - -
OK
output of gpg2 -v -r <my email> -e testfile
gpg: using PGP trust model
gpg: using subkey BBBBBBBB instead of primary key AAAAAAAA
gpg: This key belongs to us
gpg: reading from 'testfile'
gpg: writing to 'testfile.gpg'
gpg: RSA/AES256 encrypted for: "BBBBBBBB <description of me>"
output of gpg2 -v -d testfile.gpg
gpg: public key is BBBBBBBB
gpg: using subkey BBBBBBBB instead of primary key AAAAAAAA
gpg: using subkey BBBBBBBB instead of primary key AAAAAAAA
gpg: encrypted with 4096-bit RSA key, ID BBBBBBBB, created <date>
"<description of me>"
gpg: public key decryption failed: Operation cancelled
gpg: decryption failed: No secret key
gpg-agent
, and the pinentry program needed to be set topinentry-gtk-2
. Before it was set topinentry-gnome3
, which existed on my system, but it didn't work. I had to manually installpinentry-gtk-2
.