GnuPG agent and non-shell application

Patrick Brunschwig patrick at mozilla-enigmail.org
Wed Nov 14 09:17:23 CET 2007


Noiano wrote:
> Hi everybody
> I have GnuPg 1.4.6 installed and I have my .gnupg directory as a
> symbolic link pointing to an encrypted partition. As soon as I need
> my keys I mount the encrypted partition and the symbolic link is
> resolved with no problem. The problem is the use of gnupg agent: I
> type gpg-agent --daemon > gpg-agent-info so that the variable
> information are stored to that file. Under my .bashrc I have added
> the following line "source gpg-agent-info" so that the variable is
> correctly set up.
> The problem is the use of gnupg agent with program such as
> thunderbird, kpgp. They cannot see the variable GPG_AGENT_INFO as
> all shells do. I cannot set anything in .xsession because the
> encrypted partition isn't mounted on boot but on demand. Could you
> please tell me a reasonable solution for this matter?

Start Thunderbird (or kgpg) with a wrapper program that checks if
gpg-agent is running and if yes export GPG_AGENT_INFO from your
gpg-agent-info file. I found that gpg-connect-agent is quite nice to do
this.

Something like this should do the job:

#!/bin/bash
source /path/to/gpg-agent-info
export GPG_AGENT_INFO

gpg-connect-agent <<EOT
/echo OK
EOT

if [ $? -ne 0 ]; then
  ## gpg-agent is not running
  unset GPG_AGENT_INFO
fi

exec /path/to/thunderbird "$@"

-Patrick




More information about the Gnupg-users mailing list