5

I'm having an issue decrypting files with gpg2. I originally encrypted the files with gpg version 1.4. The machine I'm on now has both gpg (1.4) and gpg2. Decryption with gpg works just fine, but when I execute the same command with gpg2, it times out:

$ echo "This is a test" > test.txt
$ gpg -r MyOwnId --encrypt test.txt
  (creates test.txt.gpg)
$ gpg --decrypt test.txt.gpg
  (provide passphrase for MyOwnId)
  -> This is a test
$ gpg2 --decrypt test.txt.gpg
  (after a long timeout)
  -> gpg: encrypted with 2048-bit RSA key, ID #######, created YYYY-MM-DD "MyOwnId"
     gpg: public key decryption failed: Timeout
     gpg: decryption failed: No secret key

What's going on? It says "No secret key", but running gpg2 --list-secret-keys shows this:

/home/me/.gnupg/pubring.kbx
-------------------------------
sec   rsa2048/######## YYYY-MM-DD
uid         [ unknown] MyOwnId
ssb   rsa2048/######## YYYY-MM-DD

Update 1:

Looks like the problem isn't with gpg2 itself, but rather with my Gnome keyring or something. Previously, when I tried to decrypt files with gpg2, it would simply hang, then time out. However, once I encrypted a test file with my own key, then decrypted that file, it prompted me for my passphrase. Now that my passphrase is in my keyring, everything's working. Might have just been a temporary thing (I logged out and back in between then and now). If anyone has more info on issues like this, I'd love to know. I'll give it another day or two, then close the question if it doesn't happen again.

  • 1
    I've just got a similar issue. I needed to change the pinentry program from pinentry-qt4 to pinentry-qt in ~/.gnupg/gpg-agent.conf in order to resolve this issue. – antoyo Dec 11 '15 at 16:57
  • Can't believe how much time I wasted on this issue until I stumbled on this comment. The 'No secret key' message is definitely misleading in a situation when the actual issue is with the pinentry executable, not with the presence or absence of the secret key. In my case, it was simply a matter of editing gpg-agent.conf and specifying the full path to the pinentry executable. – thomp45793 Aug 17 '16 at 5:15
  • This happens with gpg2.1.5 encrypted file with ssb subkey only (sec key works fine), gpg2.1.5 cannot decrypt its own output, but gpg1.4 is able to decrypt the same data. On win7. – mosh Oct 13 '16 at 15:06
  • 1
    For others who have the same problem: I just needed to restart gpg-agent. – Martin Kunev Mar 27 '18 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.