Re: Questions using GPGME

2017-07-13 Thread Andreas Heinlein
Am 13.07.2017 um 09:27 schrieb Werner Koch:
> On Thu,  6 Jul 2017 14:48, aheinl...@gmx.com said:
>
>> decrypt with cancel'ing the pinentry, one with missing private key and
>> one with a truncated input file. All three gave
>>
>> print str(e): Invocation of gpgme_op_decrypt_verify: GPGME: Decryption
>> failed
> This has been fixed yesterday in GPGME.  You will now get back a
> dedicated error code for "No secret keys", "Bad passphrase", and
> "Canceled".  You need to wait for the releale of 1.9.1, though.
>
>
>
I know, I filed the bug report ;-)

Thanks again.

Andreas



signature.asc
Description: OpenPGP digital signature
___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


Re: Questions using GPGME

2017-07-13 Thread Werner Koch
On Thu,  6 Jul 2017 14:48, aheinl...@gmx.com said:

> decrypt with cancel'ing the pinentry, one with missing private key and
> one with a truncated input file. All three gave
>
> print str(e): Invocation of gpgme_op_decrypt_verify: GPGME: Decryption
> failed

This has been fixed yesterday in GPGME.  You will now get back a
dedicated error code for "No secret keys", "Bad passphrase", and
"Canceled".  You need to wait for the releale of 1.9.1, though.


Shalom-Salam,

   Werner

-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.


pgpK8e9_xo1H0.pgp
Description: PGP signature
___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


Re: Questions using GPGME

2017-07-06 Thread Justus Winter
Andreas Heinlein  writes:

> Am 06.07.2017 um 14:01 schrieb Justus Winter:
>>> 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.
> Thank you for the quick answer. I gave it a try with 3 tests, one
> decrypt with cancel'ing the pinentry, one with missing private key and
> one with a truncated input file. All three gave
>
> print str(e): Invocation of gpgme_op_decrypt_verify: GPGME: Decryption
> failed
> print e.getcode(): 152
>
> So this doesn't help.

Well, then it is not python-gpg's fault, but the underlying library or
components do not differentiate that.

> But good to know someone is working on this

I'm not.  If you feel that this is important, please file a bug.


Cheers,
Justus


signature.asc
Description: PGP signature
___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


Re: Questions using GPGME

2017-07-06 Thread Andreas Heinlein
Am 06.07.2017 um 14:01 schrieb Justus Winter:
>> 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.
Thank you for the quick answer. I gave it a try with 3 tests, one
decrypt with cancel'ing the pinentry, one with missing private key and
one with a truncated input file. All three gave

print str(e): Invocation of gpgme_op_decrypt_verify: GPGME: Decryption
failed
print e.getcode(): 152

So this doesn't help. But good to know someone is working on this; I'd
be happy to help where I can. I am not a C developer, though, but I
could test if neccessary.

Bye,
Andreas


signature.asc
Description: OpenPGP digital signature
___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


Re: Questions using GPGME

2017-07-06 Thread Justus Winter
Hi :)

Andreas Heinlein  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.


Justus


signature.asc
Description: PGP signature
___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


Questions using GPGME

2017-07-06 Thread Andreas Heinlein
Hello,

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.

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.

I wonder if these are just problems with the python interface or if the
functionality is missing from libgpgme. I am currently using gpgme 1.8.0
because that's what is packaged with Debian 9, but if you tell me I need
to upgrade, I will ;-)

Thanks,
Andreas



signature.asc
Description: OpenPGP digital signature
___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users