Re: Possible bug in GPGME Python

Ingo Klöcker <[email protected]>
Newsgroups gmane.comp.encryption.gpg.devel
Message-ID <1897896.CQOukoFCf9@daneel>
On Samstag, 4. Mai 2024 15:55:40 CEST meep via Gnupg-devel wrote:
> I would like to report what I believe to be an oversight in the Python
> wrapper of GPGME.

It's not an oversight. It's the result of the fact that the Python bindings 
effectively haven't seen any real development in the last 5 years. They do not 
support any of the new features that were added to GpgME in the last few 
years.

> In the interact(...) function of the Context class on line 1089 in
> core.py it is checked whether a key is actually passed in to the
> function:
> 
> if key is None:
>     raise ValueError("First argument cannot be None")

Which was correct at the time this code was written.

> Which is fine when editing a key, but when interacting with a smart
> card (setting the flag INTERACT_CARD) - for example to generate a key
> on it - there is not necessarily a key to be edited.
> 
> In interact_start(...) on line 131 of edit.c the presence of the key is
> only checked if card_edit isn't set:
> 
> if ((card_edit == 0 && !key) || !fnc || !out)
>   return gpg_error (GPG_ERR_INV_VALUE);

This change has been made about 18 months ago.

> Thus I believe that the intended behavior in Python would be to mirror
> the C code and only check whether the key is None if INTERACT_CARD is
> not set.

This is correct. Patches are welcome. See the file doc/HACKING for details.

Regards,
Ingo

_______________________________________________
Gnupg-devel mailing list
[email protected]
https://lists.gnupg.org/mailman/listinfo/gnupg-devel
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYKAB0WIQTbjgIOMowwlCBgvyGxb1mVFkdKugUCZnCV7wAKCRCxb1mVFkdK
ujwhAQCnVoiCP8UGhhBsNkuEhglXPf2Ps6SKKvYRPSGaBlnGCgD9HpEj2gRzMPrs
ZNI1JbXS+aTayoQ0TTokr97QMQA4HQ0=
=Q3bC
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.