gpgme passphrase help

Werner Koch wk at gnupg.org
Sat Feb 12 17:26:16 CET 2011


On Sat, 12 Feb 2011 12:25, alves.h88 at gmail.com said:

> recipients, i want the plugin to use a symmetric cipher. The problem 
> is that i can't seem to figure out how to get the passphrase 
> callback working (safely). From the GPGME manual I understood that it

Under Windows you need to work with system handles, not libc file
descriptors.  That is you need to use ReadFile and WriteFile.

However, if you use GnuPG-2 (or gpg 1.4 with the use-agent option), the
callback will not be used at all.  Instead the pinentry pops up - you
can't control that.  If you want to control that you need to implement
some kind of loopback pinentry.  Your loopback pinentry might look at
the envvar PINENTRY_USER_DATA, get the passphrase directly or indirectly
from in and pass that back to gpg-agent.  Your application then needs to
make sure that before you call something which might need a passphrase,
it has to set the appropriate info into PINENTRY_USER_DATA.  Still you
won't get the callback.


> Windows (I really want it to work cross-platform, even though i don't 
> use Windows myself, and as far as I know windows doesn't implement
> dup(2))

Windows (but not Windows CE < 6) does support dup() in the libc and
DuplicateHandle in the W32 API.


Shalom-Salam,

   Werner

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




More information about the Gnupg-users mailing list