#13 gpgme fallback code is failing to initialize
Opened by securedirective. Modified

On my particular system, I am unable to install the gpg package to leverage the primary implementation of GPG in Sigul. So I'm relying on the fallback method (pip install pygpgme)...

But Sigul fails to initialize the GPG code (server_gpg.py) when using the fallback method:

Traceback (most recent call last):
  File "/usr/local/share/sigul/server.py", line 45, in <module>
  import server_common
  File "/usr/local/share/sigul/server_common.py", line 35, in <module>
  import server_gpg as ourgpg
  File "/usr/local/share/sigul/server_gpg.py", line 148, in <module>
  class Context(gpgme.Context):
TypeError: type 'gpgme.Context' is not an acceptable base type

The implementation is simple, though:

import gpgme
...
class Context(gpgme.Context):
    # More functions here
...
ctx = Context()

But the error indicates the Context class is not intended to be subclassed like that. Also, I don't see any example or unit test in the PyGPGME library that shows it being used like that. In all cases, it's used like this:

ctx = gpgme.Context()

I see the "not an acceptable base type" error with all of the following:

  • Sigul 1.1
  • Fedora 33 (and RHEL 7.8)
  • Python 2.7.5 with pygpgme 0.1
  • Python 2.7.5 with pygpgme 0.2
  • Python 2.7.5 with pygpgme 0.3
  • Python 3.6.8 with pygpgme 0.3
  • Python 3.8.6 with pygpgme 0.3

Am I missing something here?

FYI, I have a different test host where I do have the gpg library available to me. I tested the the primary GPG implementation (pip install gpg) on that host, and your sub-classing code seems to work just fine with that library. So I think this is specific to the fallback PyGPGME implementation. Maybe something to do with that library being C code compiled to interface with Python... perhaps that results in an object that sort-of acts like a Python class, but not quite enough to allow sub-classing?


On my particular system, I am unable to install the gpg package to leverage the primary implementation of GPG in Sigul. So I'm relying on the fallback method (pip install pygpgme)...

Do not know if this helps you. But here is my working setup:
Sigul server:
CentOS Linux release 7.9.2009
sigul-server-0.207-4
gpgme 1.3.2-5
libgpg-error-1.12-3
pygpgme-0.3-9
python-2.7.5-89

Sigul bridge:
same software and versions as Sigul server

Sigul client:
same software and versions as Sigul server

I could not get Sigul 1.1 working on either CentOS 7 or Fedora 33.

BR,
Bjarne

Metadata