how to use WKD with python3?

Andre Heinecke aheinecke at
Wed Jun 3 17:16:52 CEST 2020


I'll try to answer this even though I don't completely know how to do it in 
python, but I know how it's done in C / C++.

On Wednesday 3 June 2020 12:52:46 CEST Ludwig Reiter wrote:
> how do I get public keys over WKD with python3/gpgme?

you can do a keylist with KEYLIST_MODE_LOCATE for a single mbox. If python 
does not have that (it was added later this mode is KEYLIST_MODE_EXTERNAL | 

So I think it would be:

ctx.keylist(some_uid, mode=(gpg.constants.keylist.mode.LOCAL | 

ctx.keylist(some_uid, mode=gpg.constants.keylist.mode.LOCATE)

> I didn't find anything about this in the web. It seems like python3-gpg 
> doesn't support to use WKD.

You can force that only WKD is used in the keylist if you set the auto-key-
locate context flag (gpgme_set_ctx_flag) to "clear,nodefault,wkd".

> Can someone point me to a good start point?

Good starting points are usually our "run-foo" test tools under gpgme/tests. I 
usually use them as a starting point and example.
We maintain these tools because we usually use them when developing new 
features. ;-)

Best regards,

-- - a brand of g10 Code, the GnuPG experts.

g10 Code GmbH, Erkrath/Germany, AG Wuppertal HRB14459
GF Werner Koch, USt-Id DE215605608,

GnuPG e.V., Rochusstr. 44, D-40479 Düsseldorf.  VR 11482 Düsseldorf
Vorstand: W.Koch, B.Reiter, A.Heinecke        Mail: board at
Finanzamt D-Altstadt, St-Nr: 103/5923/1779.   Tel: +49-211-28010702
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: This is a digitally signed message part.
URL: <>

More information about the Gnupg-users mailing list