GnuPG can be used to sign and encrypt files or mails.
The gpg-agent is mostly used as daemon to request and cache the password for the keychain. This is useful if GnuPG is used from an external program like kmail. It can be activated by adding following line in ~/.gnupg/gpg.conf:
This tells GnuPG to use the agent whenever it needs the password. However, the agent needs to run already. The best way is to start the agent at login. Since kdm doesn't parse ~/.xsession or ~/xinitrc the following gpg-agent-startub can be added to /etc/kde/env/:
eval "$(gpg-agent --daemon)"
This solution doesn't check, if the agent is already running!
Finally, the agent needs to know, how to ask the user for the password. This can be set in ~/.gnupg/gpg-agent.conf:
pinentry-programm /usr/bin/pinentry-gtk-2 no-grab default-cache-ttl 1800