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

Stacktrace of decryption attempt, with repro. #258

Open
sharon-indegy opened this issue May 15, 2019 · 2 comments
Open

Stacktrace of decryption attempt, with repro. #258

sharon-indegy opened this issue May 15, 2019 · 2 comments

Comments

@sharon-indegy
Copy link

Hi first let me thank you for this brilliant library.

Repro:
import gnupg

gpg = gnupg.GPG(homedir="my .gnupg")
decrypt = gpg.decrypt("valid msg omitted, works with 'gpg -d' ")

print decrypt.ok
print decrypt.data

I get:
Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/sharon/.local/lib/python2.7/site-packages/gnupg/_meta.py", line 650, in _read_response
result._handle_status(keyword, value)
File "/home/sharon/.local/lib/python2.7/site-packages/gnupg/_parsers.py", line 1757, in _handle_status
super(Crypt, self)._handle_status(key, value)
File "/home/sharon/.local/lib/python2.7/site-packages/gnupg/_parsers.py", line 1656, in _handle_status
raise ValueError("Unknown status message: %r" % key)
ValueError: Unknown status message: u'DECRYPTION_KEY'

False
the-decrypted-str-just-fine

I think it's a small matter of adding DECRYPTION_KEY to the 'pass' section of the relevant handler. But will take me some time to verify so letting you know right away.

Also, possible that I have an old version compared to this repo, used pip install on debian testing.

Please let me know if more info or testing by me is needed.
Great work!

@sharon-indegy
Copy link
Author

Just saw in your blog how much pain these GnuPG flags cause, I'm sorry to have raised yet another one of those.

@a-daniel-king
Copy link

First, I'd like to echo, "Hi first let me thank you for this brilliant library."

Second, the bug is a little noisy, but nothing is actually broken.

On WSL2/Debian, latest pip download available as of today ...
Requirement already satisfied: gnupg in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 1)) (2.3.1)

Reading ... which I think relates ... https://gnupg.readthedocs.io/en/latest/
"New in version 0.4.2: The keyid and username of the signing key are stored in the key_id and username attributes of the result, if this information is provided by gpg (which should happen if you specify extra_args=['--verbose'])."

And ... https://github.com/gpg/gnupg/blob/master/doc/DETAILS
"DECRYPTION_KEY
This line is emitted when a public key decryption succeeded in providing a session key. is the hexified fingerprint of the actual key used for decryption. is the fingerprint of the primary key. is the letter with the ownertrust; this is in general a ‘u’ which stands for ultimately trusted."

I'm currently working around with ...

$ diff _parsers.py.orig _parsers.py
1654a1655,1656

    elif key == 'DECRYPTION_KEY':
        pass

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

2 participants