select pinentry-curses/qt depending on situation

Marcus Brinkmann marcus.brinkmann at ruhr-uni-bochum.de
Mon Dec 8 20:06:49 CET 2008


Petr Uzel wrote:
> Hey list!
> 
> What is the best way (if any) to select which pinentry (-curses/-qt/-gtk) to
> run, depending on situation, i.e. whether X is running and whether we have tty.

The graphical pinentries have a fallback, which detects if no X is
running and runs the curses pinentry (compiled in statically, ie the
pinentry-curses binary is not needed in this case).

> What I want is to run pinentry-curses if there is tty (e.g. gpg in virtual
> console), and 'graphical' pinentry otherwise (e.g. signing mail in kmail).

This should work fine with the pinentry-qt binary.  Did you try it?  I
know that it works for pinentry-gtk-2.

> Now, I have a shell script named /usr/bin/pinentry, that tries to determine
> which pinentry to run and then executes it. The problem is that it can only use
> command line options that gpg-agent passes to pinentry. This options either
> does or doesn't contain --display option, depending on whether X is running.
> The rest of options (namely --ttyname) is passed to pinentry via assuan
> protocol, which obviously can not be used in the process of selecting proper
> pinentry. Without ttyname I can't distinguish whether I have virtual terminal
> or not (calling tty -s in pinentry script does not work).

pinentry-FOO uses the DISPLAY variable setting to determine if X is
running or not.

> I have two questions:
> 
> 1) Is there any way how to pass ttyname (and possibly other options) to
> pinentry via command line arguments instead of assuan protocol?
> 
> 2) More generally, is there any better way how to run various versions of
> pinentry depending on situation ?

Thanks,
Marcus





More information about the Gnupg-devel mailing list