isislovecruft/python-gnupg

Unknown status message: u'KEY_CONSIDERED'

Closed this issue · 8 comments

New status line is not supported ?

https://lists.gnupg.org/pipermail/gnupg-announce/2016q2/000390.html

In [4]: gpg.decrypt_file(open(expanduser("~/.pass.gpg")))
Exception in thread Thread-4:
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/steven/.local/lib/python2.7/site-packages/gnupg.py", line 813, in _read_response
    result.handle_status(keyword, value)
  File "/home/steven/.local/lib/python2.7/site-packages/gnupg.py", line 575, in handle_status
    Verify.handle_status(self, key, value)
  File "/home/steven/.local/lib/python2.7/site-packages/gnupg.py", line 308, in handle_status
    raise ValueError("Unknown status message: %r" % key)
ValueError: Unknown status message: u'KEY_CONSIDERED'

Out[4]: <gnupg.Crypt at 0x7f0b1db208d0>

I have same problem, but add KEY_CONSIDERED status to gnupg.py can solved my problem!
if not to reinstall gnupg to 2.1.12 version

gnupg.py diff:

--- gnupg.py    2015-09-25 01:03:56.000000000 +0800
+++ /usr/lib/python3.4/site-packages/gnupg.py   2016-09-21 08:42:40.633285241 +0800
@@ -245,7 +245,7 @@
                      "DECRYPTION_OKAY", "INV_SGNR", "FILE_START", "FILE_ERROR",
                      "FILE_DONE", "PKA_TRUST_GOOD", "PKA_TRUST_BAD", "BADMDC",
                      "GOODMDC", "NO_SGNR", "NOTATION_NAME", "NOTATION_DATA",
-                     "PROGRESS", "PINENTRY_LAUNCHED", "NEWSIG"):
+                     "PROGRESS", "PINENTRY_LAUNCHED", "NEWSIG", "KEY_CONSIDERED"):
             pass
         elif key == "BADSIG":
             self.valid = False
@@ -346,7 +346,7 @@
     }

     def handle_status(self, key, value):
-        if key == "IMPORTED":
+        if key in ("IMPORTED", "KEY_CONSIDERED"):
             # this duplicates info we already see in import_ok & import_problem
             pass
         elif key == "NODATA":
@@ -542,7 +542,7 @@
         if key in ("ENC_TO", "USERID_HINT", "GOODMDC", "END_DECRYPTION",
                    "BEGIN_SIGNING", "NO_SECKEY", "ERROR", "NODATA", "PROGRESS",
                    "CARDCTRL", "BADMDC", "SC_OP_FAILURE", "SC_OP_SUCCESS",
-                   "PINENTRY_LAUNCHED"):
+                   "PINENTRY_LAUNCHED", "KEY_CONSIDERED"):
             # in the case of ERROR, this is because a more specific error
             # message will have come first
             if key == "NODATA":
@@ -592,7 +592,7 @@

     def handle_status(self, key, value):
         if key in ("PROGRESS", "GOOD_PASSPHRASE", "NODATA", "KEY_NOT_CREATED",
-                   "PINENTRY_LAUNCHED"):
+                   "PINENTRY_LAUNCHED", "KEY_CONSIDERED"):
             pass
         elif key == "KEY_CREATED":
             (self.type,self.fingerprint) = value.split()
@@ -653,7 +653,7 @@
                    "GOOD_PASSPHRASE", "BEGIN_SIGNING", "CARDCTRL", "INV_SGNR",
                    "NO_SGNR", "MISSING_PASSPHRASE", "NEED_PASSPHRASE_PIN",
                    "SC_OP_FAILURE", "SC_OP_SUCCESS", "PROGRESS",
-                   "PINENTRY_LAUNCHED"):
+                   "PINENTRY_LAUNCHED", "KEY_CONSIDERED"):
             pass
         elif key in ("KEYEXPIRED", "SIGEXPIRED"):
             self.status = 'key expired'

@tyroneyeh It seems you are not on the right repo. This one might be the one.

Did anyone work on it ? And by the way I'm not sure to understand what this new status line means

@luluhaurat Sorry, this bug maybe is the repo https://github.com/vsajip/python-gnupg/

PR #163 fixes this issue, but it needs revision.

I also got error ValueError: Unknown status message: u'KEY_CONSIDERED'

But the trace is a bit different (I got two error from _parsers.py in different location):

Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "xxxxx/virtual_env/lib/python2.7/site-packages/gnupg/_meta.py", line 648, in _read_response
    result._handle_status(keyword, value)
  File "xxxxx/virtual_env/lib/python2.7/site-packages/gnupg/_parsers.py", line 1190, in _handle_status
    raise ValueError("Unknown status message: %r" % key)
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "xxxxx/virtual_env/lib/python2.7/site-packages/gnupg/_meta.py", line 648, in _read_response
    result._handle_status(keyword, value)
  File "xxxxx/virtual_env/lib/python2.7/site-packages/gnupg/_parsers.py", line 1627, in _handle_status
    super(Crypt, self)._handle_status(key, value)
  File "xxxxx/virtual_env/lib/python2.7/site-packages/gnupg/_parsers.py", line 1540, in _handle_status
    raise ValueError("Unknown status message: %r" % key)
ValueError: Unknown status message: u'KEY_CONSIDERED

Are these also going to be fixed? The gnupg version is 2.2.0

phryk commented

Have the same problem, and I think it's causing the return values of gen_key and import_keys to be screwed up. The calls themselves do what they're supposed to, but the result values basically say nothing worked.

From GPG.encrypt I get back a Crypt object whose ok is False, status is None and stderr not existing.
From GPG.import_keys I get back an ImportResult with everything in counts being 0, data being an empty string and fingerprints as well as results being empty lists…

Both functions essentially work, they just lie in their return values. And for both I'm seeing Exceptions thrown in threads because of KEY_CONSIDERED…

Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/local/lib/python2.7/site-packages/gnupg/_meta.py", line 650, in _read_response
result._handle_status(keyword, value)
File "/usr/local/lib/python2.7/site-packages/gnupg/_parsers.py", line 1715, in _handle_status
super(Crypt, self)._handle_status(key, value)
File "/usr/local/lib/python2.7/site-packages/gnupg/_parsers.py", line 1628, in _handle_status
raise ValueError("Unknown status message: %r" % key)
ValueError: Unknown status message: u'KEY_CONSIDERED'

Help Please!!!

Just adding my tracebacks to the pile

Exception in thread Thread-5:
Traceback (most recent call last):
  File "/Users/lynn/.pyenv/versions/3.5.2/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/Users/lynn/.pyenv/versions/3.5.2/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/lynn/apps/callisto-core/.venv/lib/python3.5/site-packages/gnupg/_meta.py", line 650, in _read_response
    result._handle_status(keyword, value)
  File "/Users/lynn/apps/callisto-core/.venv/lib/python3.5/site-packages/gnupg/_parsers.py", line 1278, in _handle_status
    raise ValueError("Unknown status message: %r" % key)
ValueError: Unknown status message: 'KEY_CONSIDERED'

Exception in thread Thread-8:
Traceback (most recent call last):
  File "/Users/lynn/.pyenv/versions/3.5.2/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/Users/lynn/.pyenv/versions/3.5.2/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/lynn/apps/callisto-core/.venv/lib/python3.5/site-packages/gnupg/_meta.py", line 650, in _read_response
    result._handle_status(keyword, value)
  File "/Users/lynn/apps/callisto-core/.venv/lib/python3.5/site-packages/gnupg/_parsers.py", line 1715, in _handle_status
    super(Crypt, self)._handle_status(key, value)
  File "/Users/lynn/apps/callisto-core/.venv/lib/python3.5/site-packages/gnupg/_parsers.py", line 1628, in _handle_status
    raise ValueError("Unknown status message: %r" % key)
ValueError: Unknown status message: 'KEY_CONSIDERED'

The PR #163 looks like it has a straightforward enough resolution, though