Questions using GPGME
justus at g10code.com
Thu Jul 6 14:01:34 CEST 2017
Andreas Heinlein <aheinlein at gmx.com> writes:
> I am currently taking first steps using GPGME with the Python interface.
> I am facing two questions:
> 1.) I'm looking for a way to get the recipients of encrypted data which
> I can not/do not want to decrypt. I.e. a message for which I do not have
> the private key. Enigmail tells me "This message was encrypted for ..."
> in such cases, and the gpg command line does the same. Is this possible
> with GPGME? Calling 'decrypt' just raises a GPGMEError in this case and
> does not return a result.
This is indeed a shortcoming of the Python bindings. I will address this.
> 2.) Is there a way to safely distinguish "User clicked cancel when asked
> for the passphrase" from other errors? I think an application should
> abort silently in this case, but I'm getting another GPGMEError without
> any clue to the reason.
Maybe. GPGMEError is a very general error, this is a bit of pyme
legacy. You can inspect the error code using .getcode(). For a quick
check, try to str() the error.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 487 bytes
Desc: not available
More information about the Gnupg-users