This is the second tutorial in a series focusing on encrypting your email. The first tutorial introduced the general concepts of encryption and how they can be used to secure and authenticate our emails. In this tutorial, I'll guide you through installing encryption software on your computer and getting started sending your first messages. For this episode, we'll use GPGTools for Mac OS X, an integration of open-source GnuPG.
In addition to reading the first episode, you may want to check out the Electronic Frontier Foundation's The Surveillance Self-Defense Guide and their explainer, An Introduction to Public Key Cryptography and PGP. They also have a guide for Windows users: How to Use PGP for Windows PC.
In upcoming episodes, we'll explore encrypting browser-based email and strengthening the "Web of Trust", and then we'll switch topics a bit to encrypting your Internet activities with use of a VPN. Finally, as part of the series on managing your digital assets after your death, we'll use what we've learned to create a secure cache of important information for your descendants in case of emergency.
What Is GPGTools?
The GPGTools suite integrates the open-source GnuPG public key support into the Mac OS X operating system to make common, everyday uses of encryption easy for the rest of us. GPGTools consists primarily of three components:
- GPG Keychain: allows you to manage your own PGP keys and public keys from acquaintances to encrypt and decrypt messages.
- Plugin for Apple Mail: allows you to encrypt and sign outbound messages and decrypt and verify inbound messages.
- GPG Services: allows third-party OS X applications to leverage PGP features such as Thunderbird.
Getting Started With GPGTools
Let's walk through how to begin using GPGTools and send our first encrypted message.
Download and Verify the Tools
First, visit the GPGTools home page, scroll down and click the Download GPG Suite button:
As we mentioned in part one, if a surveillance authority or hacker wished to pose a man-in-the-middle attack, they could deliver a compromised version of the GPG download to your machine, exposing all of your messaging. So let's check that the digital signature on the download is the same as the one published on the website.
First, we'll check the
checksum on our downloaded package from Terminal.
Jeff$ cd ~/Downloads Jeff$ shasum GPG_Suite-2015.03-b6.dmg 6621fc1da5211650b6ef4aa959fdd385a6a5a6d5 GPG_Suite-2015.03-b6.dmg
Then, we'll peek at the
checksum published on the home page:
Since they are the same, we know we received authentic, safe code. See also How to verify the downloaded GPG Suite?
Once verified, launch the disk image. You'll see the following in Finder:
Double click the Install.pkg package to begin the installation.
Follow the standard Mac OS X application installation wizard. Eventually, you'll see the success page:
Launch the GPG Keychain application. This is the program that helps you track all of your colleague's public keys as well as your own public and private key:
Creating a Key
To begin signing and encrypting messages, we need to create our own key pair. Click on the New key icon. Fill in your name and email address and a complex passphrase. The Intercept recently published an ideal method of choosing a strong passphrase for your private key: Passphrases That You Can Memorize — But That Even the NSA Can't Guess:
GPGTools will generate a key pair for you using... math, complicated math:
When it's done, it will display a listing for your key pair:
Now, we're almost ready to send encrypted and signed messages.
Signing and Sending an Encrypted Message
You can sign any message simply using your private key, but if you want to encrypt a message, you need the recipient's public key. I downloaded a friend's public key from a trusted key server. Alternately, you could upload a public key given to you on a USB flash drive.
Click Import and select the .asc key file to import it into the GPG Keychain:
Once that's done, you can send a message to this user. Note the green OpenPGP badge in the upper right corner. And notice the blue lock and checkmark icons on the Subject line. These indicate that my outbound message will be encrypted and signed.
When I click send, GPGTools will ask me to enter my Passphrase for it to access my key pair:
If you look at the message in the Outbox, you'll see that the message is encrypted in a file called encrypted.asc:
Here's an example of that file's contents—gibberish except to the recipient with the proper private key:
-----BEGIN PGP MESSAGE----- Comment: GPGTools - https://gpgtools.org hQIOAwfq5Jrby+ZxEAf8CCTvId9rb2iBRKU89YGAjYVEFLcTXR7HStgrEmjkm44m XUcgRjnuinynE3V4dlaxWPqwNWRu76QmZZ1q+70BJIFwbVPOfgmLjKqm3ZwwU//v TDcCAC/DqZKmPgVb72xPb4YhVp6milPALWM5VJGJ2ChK83Ne9IOjygzdBsCEAvzF cfuqBbha7WBQXClt2ZZfZNFJldotTJOtI7HDdojKpc7zNM1II6lOF6byMFv66krD ujAK5SMVhSHZKY/9baWF4/bQpEWdG3xHxy+Dgf7W6tqffIx12n2ukV3a1VgITaMr 2bPmCQFwfvfwdGM1g6kEBETsZBlK1ApluJtv/1KwZQf+OZAinW9dsxljcH7fBW3s bisx8EZYzqUqTaCKbrB9oiuJSPv5gvWYbGUkjvPNaYpP/QWcT0w2+RiRa8FzsN94 m7JaCu0pfZCUa5Zv1xeU2qDOMSsE/mKnTYTq3E1CJAeUvzhZaWnvNVWR+XVMSQDw 6ZxheticQ3gdn119q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 MTUr2ZYUz7ZsgUeM5vAbZTHMNKj5TdLdjBLXDyBH8YyQ7qf6WOozzPwmzkh8RVSm bmu0k+Jmo9GdX/9PwLqexDwpC1cAsVmKQsFKDsRw =XaKD -----END PGP MESSAGE-----
Decrypting and Authenticating a Message
When you receive messages that have been encrypted with your public key, Apple Mail will use GPGTools to automatically verify the sender's digital signature and decrypt the message contents. Note the Security: Encrypted, Signed indicators:
I hope you've recruited a few friends to send and receive encrypted messages with. Coming up in the next tutorial, I'll guide you through using a new service which strengthens the Web of Trust, creating a sophisticated audit trail of authentication for the validity of public keys.
Subscribe below and we’ll send you a weekly email summary of all new Code tutorials. Never miss out on learning about the next big thing.Update me weekly
Envato Tuts+ tutorials are translated into other languages by our community members—you can be involved too!Translate this post