12.11. Encrypting Mail with PGP or GnuPG

KMail allows you to encrypt outgoing e-mail messages. To encrypt your e-mail, first generate a key pair as described in 11. Encryption with KGpg. KMail then needs to be restarted to be able to use the encryption features.

To configure the details of the encryption procedure, select Settings+Configure KMail…+Security+Crypto plugins. When you are finished with these settings, select Identities to specify the identity under which to send encrypted and signed messages. Then use Modify… to open a window in which to enter your OpenPGP key. After confirming with OK, the key should be displayed in the corresponding field. Close the configuration dialog with Ok.

The public key must be made available to recipients of a signed message so they can verify its authenticity. Other users must have your public key to send encrypted messages to you, the owner of the key.

12.11.1. Signing Messages

Create your messages as usual. Before sending the message, select Options+Sign message or the corresponding toolbar button. The message is now ready to be sent. To sign a message, KMail must know your PGP or GnuPG password. However, if you have already provided the password, KMail signs the message without requesting any further information. Check whether a message has actually been signed by looking into the sent-mail folder (or the outbox if you did not use Send Now). The corresponding message should be explicitly marked as having been signed.

12.11.2. Checking the Signature of a Received Message

If KMail is able to verify the signature of an e-mail, a green frame with the key ID is displayed. If the signature cannot be verified, a yellow frame with an alert is displayed. This means that you do not have a suitable public key for the signature.

12.11.3. Sending Public Keys

Create a message for the person who should receive your public key. Then select Attach+Attach Public Key. The mail can now be sent. There is no guarantee that the recipient of a signed message receives the correct key. It is possible for the mail to be intercepted on the way to the recipient and signed with another key. Therefore, the recipient should check the attached key by comparing the finger print with a previously received value. Further information about this can be found in the PGP and GnuPG documentation.

12.11.4. Decrypting Messages

In KMail, select the message to decrypt. Enter your password when prompted. KMail attempts to decrypt the message. If it was encrypted with your public key, KMail displays it in clear text. If not, you cannot read the e-mail message. KMail saves these e-mail messages in encrypted form to prevent anyone from reading them without your password.

12.11.5. Encrypting Messages

To send an encrypted message to a recipient for whom you have the public key, simply write the message in the Create Message window. Before sending the message, click the red key icon in the window's toolbar. Now the message can be sent. If KMail cannot find a key for the recipient, a list with all available keys is shown. Select the appropriate one from the list or abort the process. KMail also informs you if errors occur during the encryption process. You cannot read encrypted messages if you did not click Always encrypt to self in the Security tab.