Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failure to decrypt on gpg 2.1.x #249

Closed
redshiftzero opened this issue Jan 29, 2019 · 1 comment
Closed

failure to decrypt on gpg 2.1.x #249

redshiftzero opened this issue Jan 29, 2019 · 1 comment

Comments

@redshiftzero
Copy link

Versions

  • Python 2.7.12
  • gpg (GnuPG) 2.1.11
  • libgcrypt 1.6.5
  • gpg.__version__ 3.1.1 (latest version of this library at the time this issue was filed)

This is a followup from the comments on the closed issue #137 (comment) which describes a failure to decrypt files using recent (gpg>=2.1.x) versions of gpg2

Reproducer

import pretty_bad_protocol as gnupg

gpg_key_dir = '/tmp/.gnupg/'

gpg = gnupg.GPG(binary='gpg2', homedir=gpg_key_dir)

# Key created for testing
fingerprints = ['07683535D17BFBF548C6A1AE12655CED33D73316']

encrypted = gpg.encrypt('test data', *fingerprints, armor=False, always_trust=True)

print('decrypt')

decrypted = gpg.decrypt(encrypted.data, passphrase='test')

print(decrypted.ok)

print(decrypted.stderr)

Output

decrypt
False
[GNUPG:] ENC_TO 969425E675C7D534 1 0
[GNUPG:] PINENTRY_LAUNCHED 1142
gpg: encrypted with 2048-bit RSA key, ID 75C7D534, created 2019-01-29
      " (test) <[email protected]>"
gpg: public key decryption failed: Inappropriate ioctl for device
[GNUPG:] ERROR pkdecrypt_failed 83918950
[GNUPG:] BEGIN_DECRYPTION
[GNUPG:] DECRYPTION_FAILED
gpg: decryption failed: No secret key
[GNUPG:] END_DECRYPTION

Comments

I've tried adding allow-loopback-pinentry to gpg-agent.conf and restarted gpg-agent as suggested in #137 (comment) on the latest version of this library but it didn't resolve the issue. Anyone have any ideas on this one?

(note: these test steps work fine for me on earlier versions of gpg)

@redshiftzero
Copy link
Author

ah, passing in options=['--pinentry-mode loopback'] worked, closing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant