passphrase callback

folkert folkert at vanheusden.com
Wed May 27 23:07:17 CEST 2015


Hi,

Found out that the documentation on the gnu website is no longer
up-to-date and that I need to set the pin mode to loop-back:

gpgme_set_passphrase_cb(*ctx, NULL, NULL);

(void)gpgme_set_pinentry_mode(*ctx, GPGME_PINENTRY_MODE_LOOPBACK);

gpgme_set_passphrase_cb(*ctx, passphrase_cb, data);


Now something strange happens: apparently this lets gpgme use a new
gpg2 command-line switch and this fails:

[pid 14558] execve("/usr/bin/gpg2", ["gpg2", "--enable-special-filenames", "--pinentry-mode=loopback", "--no-sk-comment", "--lc-messages", "C", "--lc-ctype", "C", "--status-fd", "4", "--no-tty", "--charset", "utf8", "--enable-progress-filter", "--display", ":0.0", "--command-fd", "5", "--encrypt", "--sign", "--always-trust", "-r", "95C76C5EF83943DA2F322CF4D2C2514414B7E8E6", "-u", "D2C2514414B7E8E6", "--output", "-", "--", "-&9"], [/* 31 vars */]) = 0

[pid 14558] write(2, "gpg: invalid option \"--pinentry-mode=loopback\"\n", 47) = 47

This is a bit odd I would say?

Please advise.

On Wed, May 27, 2015 at 09:30:09PM +0200, folkert wrote:
> Hi,
> 
> I'm trying to use gpgme in an unattended environment, e.g. without user
> interaction.
> Now I try to use gpgme_set_passphrase_cb() and I find two issues:
> - when I invoke it without the ctx beining setup, it silently
>   ignores/fails
> - even though I set the passphrase callback, it still tries to invoke
>   the gpg-agent gui. if I remove that program (as the situation will be
>   on he server), it still doesn't use the passphrase callback
> 
> How to proceed?
> 
> Thanks.
> 
> Versions of software used:
> 
> gnupg 	 1.4.18-7
> gnupg2 	 2.0.26-6
> gnupg-agent 	 2.0.26-6
> gpgv 	 1.4.18-7
> libgpg-error0:amd64 	 1.17-3
> libgpg-error0:i386 	 1.17-3
> libgpg-error-dev 	 1.17-3
> libgpgme11:amd64 	 1.5.1-6
> libgpgme11-dev 	 1.5.1-6
> libgpgme++2 	 4:4.14.2-2+b1
> 
> 
> Folkert van Heusden
> 
> -- 
> 
> _______________________________________________
> Gnupg-devel mailing list
> Gnupg-devel at gnupg.org
> http://lists.gnupg.org/mailman/listinfo/gnupg-devel


Folkert van Heusden

-- 
You've probably gotten really fed up with never winning in the Mega-
Millions lottery. Well, weep no longer: www.smartwinning.info tells
you everything that might help you deciding what numbers to choose.
With nice graphs and pretty animations!



More information about the Gnupg-devel mailing list