KMail Trunk: Signing

If, like me, you run KMail trunk (what will be 4.2), sign your emails and don’t use gpg-agent, you may have found that signing emails suddenly stopped working a while back.  I finally traced the problem: a change in the way signing is done with the gpgme backend means that kleo, the magic behind all things cryptographic in kdepim, no longer provides a password entry dialog.  The reason is that the signing is done in a side thread, and GUI stuff can only be done in the main thread.

The solution?  Use gpg-agent, of course.  You need to install gpg-agent and the pinentry package, and then put a script (call it – the .sh is important) in $KDEHOME/env that starts gpg-agent.  The contents of my ~/.kde/env/ file are simply:

eval $(gpg-agent --daemon --pinentry-program /usr/bin/pinentry-qt)

You should also stop it again at logout.  To do this put the following script in the $KDEHOME/shutdown folder and make it executable:

# the second field of the GPG_AGENT_INFO variable is the
# process ID of the gpg-agent active in the current session
# so we'll just kill that, rather than all of them
[ -n "${GPG_AGENT_INFO}" ] &&
    kill $(echo "${GPG_AGENT_INFO}" | cut -d ':' -f 2)

All this stolen from a Gentoo HOWTO.


8 Responses to “KMail Trunk: Signing”

  1. Jucato Says:

    Thank you very much! This just made my day! I have been at a loss trying to figure out how to get my e-mails signed using KMail (in 4.1). Thank you again! 🙂

  2. مهرداد Says:

    but it don’t working for me! 😦
    i’m using kmail 1.10.1 on KDE 4.1.2 on Kubuntu

  3. مهرداد Says:

    🙂 it works…

  4. حل مشکل امضای ایمیل با Kmail جدید (KDE4.1) « MGroup Says:

    […] مطلب از اینجا دزدیده […]

  5. Cassiano Bertol Leal Says:

    Thanks, it works!

    You just forgot to mention that should also be made executable. 😉

  6. Martin Says:

    Great workaround, however it was not working out of the box for me on archlinux with kdemod 4.3 and kmail 1.12.2. The reason was qt3 was missing. After installing qt3 it works.
    So if this workaround is not working for you I suggest to start pinentry-qt from a terminal and look at the output. If something like “error while loading shared libraries: cannot open shared object file: No such file or directory” shows up it is likely that qt3 is missing.

  7. Kmail does not ask for PGP password « Says:

    […] […]

  8. Anotaciones » Blog Archive » Importar clave gpg. kgpg que gran programa Says:

    […] Para que puedas enviar los correos firmados en kmail: […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: