pixelated / pixelated-user-agent

User facing components of Pixelated: a JavaScript single page app and a RESTful service.
GNU Affero General Public License v3.0
159 stars 72 forks source link

Cannot generate GPG keys when using GPG 2.1 #1075

Open tuliocasagrande opened 7 years ago

tuliocasagrande commented 7 years ago

We are getting the following error when trying to generate GPG keys and using GPG version 2.1 or higher:

2017-05-30 17:00:21 [pixelated.bitmask_libraries.keymanager] INFO Generating keys - this could take a while...
2017-05-30 17:00:21 [leap.bitmask.keymanager.openpgp] INFO About to generate keys... This might take SOME time.
2017-05-30 17:00:21 [twisted.web.client._HTTP11ClientFactory] INFO Stopping factory <twisted.web.client._HTTP11ClientFactory instance at 0x10ad27950>
2017-05-30 17:00:22 [gnupg] WARNING GnuPG has just attempted to launch whichever pinentry program you have configured, in order to obtain the passphrase for this key.  If you did not use the `passphrase=` parameter, please try doing so.  Otherwise, see Issues #122 and #137:
https://github.com/isislovecruft/python-gnupg/issues/122
https://github.com/isislovecruft/python-gnupg/issues/137
2017-05-30 17:00:22 [stderr] ERROR Exception in thread Thread-17:
2017-05-30 17:00:22 [stderr] ERROR Traceback (most recent call last):
2017-05-30 17:00:22 [stderr] ERROR   File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
2017-05-30 17:00:22 [stderr] ERROR     self.run()
2017-05-30 17:00:22 [stderr] ERROR   File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 754, in run
2017-05-30 17:00:22 [stderr] ERROR     self.__target(*self.__args, **self.__kwargs)
2017-05-30 17:00:22 [stderr] ERROR   File "/Users/tcasagra/.venvs/pixua/src/gnupg/gnupg/_meta.py", line 650, in _read_response
2017-05-30 17:00:22 [stderr] ERROR     result._handle_status(keyword, value)
2017-05-30 17:00:22 [stderr] ERROR   File "/Users/tcasagra/.venvs/pixua/src/gnupg/gnupg/_parsers.py", line 993, in _handle_status
2017-05-30 17:00:22 [stderr] ERROR     raise ValueError("Unknown status message: %r" % key)
2017-05-30 17:00:22 [stderr] ERROR ValueError: Unknown status message: u'ERROR'
2017-05-30 17:00:22 [stderr] ERROR
2017-05-30 17:00:22 [leap.bitmask.keymanager.openpgp] INFO Keys for cora@mail.bitmask.net have been successfully generated.
2017-05-30 17:00:23 [leap.common.check] ERROR Bug: Keyring has wrong number of keys: 0.
2017-05-30 17:00:23 [leap.common.check] ERROR   File "/Users/tcasagra/.venvs/pixua/bin/pixelated-user-agent", line 11, in <module>
2017-05-30 17:00:23 [leap.common.check] ERROR     load_entry_point('pixelated-user-agent', 'console_scripts', 'pixelated-user-agent')()
2017-05-30 17:00:23 [leap.common.check] ERROR   File "/Users/tcasagra/Pixelated/pixelated-user-agent/service/pixelated/application.py", line 107, in initialize
2017-05-30 17:00:23 [leap.common.check] ERROR     reactor.run()
2017-05-30 17:00:23 [leap.common.check] ERROR   File "/Users/tcasagra/.venvs/pixua/lib/python2.7/site-packages/twisted/internet/base.py", line 1194, in run
2017-05-30 17:00:23 [leap.common.check] ERROR     self.mainLoop()
2017-05-30 17:00:23 [leap.common.check] ERROR   File "/Users/tcasagra/.venvs/pixua/lib/python2.7/site-packages/twisted/internet/base.py", line 1203, in mainLoop
2017-05-30 17:00:23 [leap.common.check] ERROR     self.runUntilCurrent()
2017-05-30 17:00:23 [leap.common.check] ERROR   File "/Users/tcasagra/.venvs/pixua/lib/python2.7/site-packages/twisted/internet/base.py", line 798, in runUntilCurrent
2017-05-30 17:00:23 [leap.common.check] ERROR     f(*a, **kw)
2017-05-30 17:00:23 [leap.common.check] ERROR   File "/Users/tcasagra/.venvs/pixua/lib/python2.7/site-packages/twisted/internet/defer.py", line 393, in callback
2017-05-30 17:00:23 [leap.common.check] ERROR     self._startRunCallbacks(result)
2017-05-30 17:00:23 [leap.common.check] ERROR   File "/Users/tcasagra/.venvs/pixua/lib/python2.7/site-packages/twisted/internet/defer.py", line 501, in _startRunCallbacks
2017-05-30 17:00:23 [leap.common.check] ERROR     self._runCallbacks()
2017-05-30 17:00:23 [leap.common.check] ERROR   File "/Users/tcasagra/.venvs/pixua/lib/python2.7/site-packages/twisted/internet/defer.py", line 588, in _runCallbacks
2017-05-30 17:00:23 [leap.common.check] ERROR     current.result = callback(current.result, *args, **kw)
2017-05-30 17:00:23 [leap.common.check] ERROR   File "/Users/tcasagra/.venvs/pixua/lib/python2.7/site-packages/twisted/internet/defer.py", line 1184, in gotResult
2017-05-30 17:00:23 [leap.common.check] ERROR     _inlineCallbacks(r, g, deferred)
2017-05-30 17:00:23 [leap.common.check] ERROR   File "/Users/tcasagra/.venvs/pixua/lib/python2.7/site-packages/twisted/internet/defer.py", line 1128, in _inlineCallbacks
2017-05-30 17:00:23 [leap.common.check] ERROR     result = g.send(result)
2017-05-30 17:00:23 [leap.common.check] ERROR   File "/Users/tcasagra/.venvs/pixua/src/leap.bitmask/src/leap/bitmask/keymanager/openpgp.py", line 234, in _gen_key
2017-05-30 17:00:23 [leap.common.check] ERROR     'Keyring has wrong number of keys: %d.' % len(pubkeys))
2017-05-30 17:00:23 [pixelated.config.leap] WARN AssertionError: Keyring has wrong number of keys: 0.

It seems there are similar issues on python-gnupg concerning GPG v2: https://github.com/isislovecruft/python-gnupg/issues/122 https://github.com/isislovecruft/python-gnupg/issues/137

tuliocasagrande commented 7 years ago

The key generation is confirmed to work with GPG versions 1.4 and 2.0. This bug only occurs with GPG 2.1.