Original URL: https://www.theregister.com/2008/11/14/email_encryption_how_to/

Still sending naked email? Get your protection here

Buckle your seatbelt, encrypt your bits

By Dan Goodin

Posted in OSes, 14th November 2008 20:22 GMT

Security How-to In this age of brazen, warrantless wiretaps and never-ending data breaches, you'd think email encryption would be considered de rigueur. Alas, even among the digerati it's rarely given the time of day because encryption is seen as an exotic undertaking that brings more hassle than benefit.

To be sure, incorporating a robust encryption regimen into a routine that involves sending and receiving hundreds of emails each day won't happen by accident. If you've never done it before, there's a modestly steep learning curve that's necessary not only for you, but for all the people you correspond with. No wonder few people bother.

Jon Callas, CTO of encryption software provider PGP, likens encrypting email to wearing a seatbelt, which a few decades ago was so unpopular that many people only did when they were required by law to do so.

"You only need to wear a seatbelt on the day you get in a crash and you only need to encrypt the one email that's going to get lost," he says. "The way that you make sure you encrypt that one mail that needs to be encrypted is the same way you make sure you wear your seatbelt on the one day you get in a crash and that is you do it all the time."

Your writer was forced to confront his own encryption apathy about a year ago, when asked for a public key by a source promising a juicy scoop. Two days later, the key was proffered, but the experience made it clear that the road to encryption Nirvana - at least for us Windows users - is paved with solutions that are confusing, incomplete, or impractical.

For those so inclined, PGP sells products such as PGP Desktop Email that Callas says "literally passes the my-75-year-old-mother-can-use" test. Your writer, on the other hand, opted for Gpg4Win, a free Windows implementation of the open source Gnu Privacy Guard (GnuPG). Used with the Enigmail add-on for Mozilla's Thunderbird email client, it offers everything needed to generate, store, and manage digital keys for email encryption.

What follows is a step-by-step tutorial for Windows users. (Linux geeks looking for help should seek out Brenno de Winter's excellent how-to here.)

Step 1: Installing Gpg4Win

Navigate to Gpg4Win's download page and download the latest full version of the program. At time of writing (and indeed since November 2007) that was gpg4win-1.1.3.exe.

Gpg4Win download page

Gpg4Win download page

Whenever you're installing a piece of software this sensitive, it's a good idea to verify that the program you've just downloaded is the real thing by checking its SHA1 or MD5 checksums. SlavaSoft's HashCalc is one reliable way to do this. Download and install it, and then compare the checksum it computes for gpg4win-1.1.3.exe against the checksums provided here.

Verify Gpg4Win using hashes

Verify the gpg4win executable is legit

Once you've verified the integrity of the exe, double click it to install. You will now be presented with a screen of components to install. They include:

(I couldn't find GPGol in my setup, but I didn't care since it only works only with Outlook 2003).

The setup also offers documentation that is worth having, though unless you speak German, there's no reason to install the advanced manual. Other than that, be sure to check everything else.

Gpg4Win install window

Install all components (except possibly advanced manual)

Once completed, you'll find a new entry in the All Programs folder of Windows called GnuPG for Windows. Highlighting that item will reveal the modules of Gpg4Win that provide things such key management and email encryption. Here's what it looks like:

Once Gpg4Win is installed, here's what it looks like in the start menu

Once Gpg4Win is installed, here's what you get

Step 2: Generating your key pair

Now it's time to generate the key pair that will be used to encrypt and decrypt messages. (If this is your first time, it's not a bad idea to create a practice key in case you make any mistakes). To do so, open GPA, short for GNU Privacy Assistant. The first time the program is opened, it will open a window prompting you to generate a private key. This is exactly what you want to do, so click "Generate key now."

Key generation window the first time you open GPA

What you see the first time you open GPA

Most of the prompts are self-explanatory, but a few things are worth bearing in mind. First, be sure to pay close attention to the passphrase you choose. Choices such as "password" and "1234567" are clearly not acceptable. Better is a randomly generated password using a program like Password Safe. Even better still is use of a long phrase that's idiosyncratic enough that only you will know it. Whatever passphrase you use, be sure to remember it. Your key will be useless without it.

GPA will also ask you if you want to back up your private key. This is generally a good idea, because if you lose it, you will be unable to read encrypted messages sent to you. The best idea is to save the key to a USB thumb drive and then stash it in a secure lockbox (along with your passphrase written out). Be sure to enter a file name (e.g. mysecretkey.asc) in the backup dialog box, or GPA will give you a cryptic error message.

When you're done, the key you just created will appear in GPA's keyring editor. Notice that with the Details tab selected, GPA says that the key has both a private and public part.

Your key in the GPA keyring editor

Your key in the GPA keyring editor

For people to send you an encrypted email, they'll need your public key. You can get this by right-clicking on your key in the GPA keyring editor and choosing Copy. In theory, you should be able to paste the key into the body of an email message and send it to one or more of your contacts. In practice, GPA seems to add an extra carriage return to keys, which makes sending them in the body of an email problematic. To get around this, go to Start > All Programs > Accessories > Notepad, and paste the public key into the body. Then save using a file name such as mypublickey.asc and email it as an attachment to one or more contacts.

Your contacts, assuming they already know how to send encrypted email, now have what they need to send an encrypted email that you - and you alone - can decrypt. To make that easy, you'll need to install the Enigmail add-on to Thunderbird.

Step 3: Install the Enigmail add-on for Thunderbird

If you plan to receive encrypted emails on a regular basis, you'll probably want a seamless way to decrypt them. Plenty of email clients, Thunderbird among them, have ways to do just that. This tutorial assumes you've already installed Thunderbird. If you haven't, you can either install it first or skip this step and find some other way to decrypt your messages.

Navigate to this page on the add-ons section of the Mozilla website. Click on the "Download now" link and save the file (at time of writing it was enigmail-0.95.7-tb+sm.xpi) to your desktop.

In Thunderbird, go to Tools > Add-ons and then click the Install button at the bottom left of the popup window. In the "Select an extension to install" window, change the folder to your desktop. In the list of files, highlight the Enigmail file you just downloaded and choose Open. In the resulting Software Installation window, click Install Now. Then restart Thunderbird.

Enigmail should immediately open an OpenPGP Setup Wizard that prompts you to select a key to sign and encrypt email. Highlight the key you just created and select Next.

Once Enigmail opens, choose the key you just created

Once Enigmail opens, choose the key you just created

By now, one of the contacts you emailed earlier should have had time to send you an encrypted message using your public key. When you use Thunderbird to open it, you'll be prompted for your passphrase. Enter the passphrase you chose when you generated your key pair. If all goes well, Enigmail will decrypt the message and it will look something like this:

With the private key, email looks like this

With the private key, email looks like this

Congratulations. You've just decrypted your first email. For an idea what the same message looks like to anyone without the key, open the same email on a web-based email service or a client that hasn't been set up to work with your key pair. It will look something like this:

To a snoop without the private key, the same email looks like this

To a snoop without the private key, the same email looks like this

Note that subject lines are never encrypted, so remember to never include private information there.

Get more from Enigmail

Enigmail can be used for several other purposes, including adding your contacts' public keys to the keyring. The plug-in should automatically detect emails that include a public key and invoke a pop-up prompting you to add the key. Contacts whose public keys have been added to your keyring are then able to sign messages that prove they were generated with the corresponding private key. Such messages look like this:

Emails signed with a sender's private key look like this

Emails signed with a sender's private key guarantee its origin

You can also digitally sign messages you send to others using the OpenPGP button that now appears on Thunderbird's composition window and, if you've got the public key of a recipient, you can also send that person an encrypted email.

Epilogue

With your new-found ability to send and receive encrypted email, you'll want to get in the habit of practicing sound crypto hygiene that goes beyond the scope of this article. The Gpg4Win folks offer their own how-to here, and the GNU Privacy Handbook also provides useful information. The Enigmail creators also have helpful information here.

But we'd be remiss if we didn't offer this one non-negotiable rule: Trust only public keys that you have verified in advance with the sender. One common verification practice is to speak with the other person by phone or in person and compare the key's fingerprint, which the GPA keyring editor displays when a key is highlighted. Once you're satisfied the key is legit, you should sign it. To do that, right click on it in the GPA keyring editor, choose Set Owner Trust, choose the Full radio button and click OK.

In a world of repressive governments and a growing reliance on insecure networks, there's no way anyone can be sure their most sensitive messages aren't intercepted by the forces of darkness. But you can make it mathematically improbable that all but the most well-funded snoops could ever make heads or tales of your communications. Of course, only you can make that happen. The ball is in your court. ®