gpgme tutorial t-decrypt.c -> Bad passphrase

Mandar Mhatre mandar.mhatre at
Tue Jun 28 11:16:34 CEST 2016

Hello List,
@Justus thanks for the kind reply!

I found some more related issues on the internet forums and tried the listed
1. As Justus suggested, I tried that but its only applicable to gnupg 2.13+,
I am having 1.4 and 2.0.30 installed on my Debian.
2. Tried to achieve this solution in the code. Gpgme_set_pinentry_mode(ctx,
	I expected no change in the output, considering the above point. But
interestingly now the error changes to "No data". A bit strange !
3. On May 28, 2015 in reply to Folkert van Heusdens query, Werner Koch
replied saying 'no-use-agent' should be used in gpg.conf. Does not affect
the output and passphrase_cb still isn't being executed.
4. in gpg.conf uncommenting 'Passphrase agent' results in error "No data".

As a result, the problem persists and I couldn't set my password.

I hope I have been enough descriptive in stating my problem.
Thank you in advance for your time and help.

With kind regards,
Mandar Mhatre

-----Original Message-----
From: Justus Winter [mailto:teythoon at]
Sent: Montag, 27. Juni 2016 17:35
To: Mandar Mhatre; gnupg-users at
Subject: Re: gpgme tutorial t-decrypt.c -> Bad passphrase


Mandar Mhatre <mandar.mhatre at> writes:
> I am getting an error while running t-decrypt.c (and t-sign.c as well)
> as stated in the subject line. The passphrase_cb has been implemented
> in ‘t-support.h’ but somehow the code doesn’t retrieve the required
> password. I tried to implement my own callback function on the same
> lines and came to know that this function is never being called.

GnuPG is getting the passphrase using the pinentry mechanism.  If you want
to supply it using a callback, you have to set the pinentry mode to
loopback.  Furthermore, if you are using GnuPG < 2.12, you need to allow
that using --allow-loopback-pinentry.


More information about the Gnupg-users mailing list