python GPGME bindings and key signatures

brent s. bts at square-r00t.net
Mon Nov 5 19:08:34 CET 2018


On 11/5/18 6:14 AM, Tobias Mueller wrote:
> yeah, this is one of the peculiarities of the gpgme interface.
> You have to request the key list with signatures.
> I'd link to the documentation, but as there is still no full HTML
> version I cannot easily press Ctrl+F and search.
> 
> I have the following in my code:
> 
>     # *sigh* gpgme is killing me. With gpgme 1.8 we have to
>     # set_keylist_mode before we can call keylist.  With gpgme 1.9
>     # keylist takes a mode argument and overrides whatever has been
>     # set before.  In order to come with something compatible with both
>     # 1.8 and 1.9 we have to set_keylist_mode and NOT call ctx.keylist
>     # but rather the bare op_keylist_all.  In 1.8 that requires two
>     # arguments.
>     mode = gpg.constants.keylist.mode.LOCAL | gpg.constants.keylist.mode.SIGS
>     secret = False
>     ctx.set_keylist_mode(mode)
>     keys = list(ctx.op_keylist_all(key.fpr, secret))
>     # With gpgme 1.9 we can simply do:
>     # keys = list(ctx.keylist(key.fpr), mode=mode)
> 
> 
> HTH,
>   Tobi
> 


Tobi -

This helps a TON. Thank you so much!

Something else I just ran into last night is it seems
gpg.constants.import is unusable due to the :

>>> import gpg
>>> gpg.constants.import.NEW
  File "<stdin>", line 1
    gpg.constants.import.NEW
                       ^
SyntaxError: invalid syntax
>>> sys.version
'3.7.1 (default, Oct 22 2018, 10:41:28) \n[GCC 8.2.1 20180831]'

I presume that's something I'll need a bug report for.

Thanks again, Tobi!

-- 
brent saner
https://square-r00t.net/
GPG info: https://square-r00t.net/gpg-info

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 899 bytes
Desc: OpenPGP digital signature
URL: <https://lists.gnupg.org/pipermail/gnupg-devel/attachments/20181105/1cb250ac/attachment.sig>


More information about the Gnupg-devel mailing list