1. Encryption
  2. Privacy
  3. Security

Sending encrypted e-mails with PGP

PGP stands for Pretty Good Privacy – encryption software which uses a combination of hashing, symmetric-key and public-key cryptography for secure data communication. The first version of PGP was created in 1991 by Phil Zimmermann. Read more about PGP in Wikipedia.

How it works in simple words

PGP works by creating a key pair – public and private. Public key is shared among the senders and used to encrypt messages/files. Private key is used to decrypt emails and files encrypted with the public key. For example, Mike wants to receive an encrypted email from Joe. For this, Mike creates a key pair and shares his public key with Joe. Then Joe creates a message, encrypt it with Mike’s public key and sends it. Mike receives an encrypted message and decrypts it with his private key.

How encrypted email looks like?

On the Picture 1 below you can see how encrypted email sent to Gmail looks like. This email consist of two parts – one part is not encrypted and another part is encrypted. One cannot know the content of encrypted part without private key of the intended recipient.

Picture 1. Encrypted email sent to a Gmail user

Sending an encrypted email

Before one can send an encrypted email to you, you need to create a key pair – public and private key. The easiest way to do this is by using PGPTool. PGPTool is a java based desktop application which is capable of creating key pairs, encrypting and decrypting message and files.

Creating a key pair

  1. Download and install PGPTool from: https://pgptool.github.io/
  2. Create key pair like it shown on the Picture 2 and 3 by going to “Key Ring” > “Create PGP Key”
Picture 2. Creating Key Pair
Picture 3. Creating Key Pair

Enter your name, e-mail address and passphrase. Passphrase will be prompted to decrypted message with the private key.

Share Public Key with the senders

Navigate to “Key ring” in order to copy your public key – Picture 4.

Picture 4. Copy public key.

Your Public Key will look something like this. We will use this public key to send encrypted email to our imaginary Bob Johnson.

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: BCPG v1.63

mQSuBGHj9+sRDACmvRnr3fTVxDuGs9k6xyL+MasjoiTAzwfVXvXez1Vrmj94Xw+C
PJihNDtCIFUIqhtClVsDIVJjU30PYea2oiWP6mYaEFFPpBD5RP3wDXjHgsQhDERA
Kphg1BopJ2M+QTnFXQVMeImmxBVAL4sFzGZ7loXwNSbyxbGYVPBSVsS+kTLAJPaX
+AZzOgP7Q6gwB+R4/pKMdAE8zFROlIr0CGlLdXeRaVU/+x9WtBJ+XQl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86jLvhJVdDzp0ZMwqOW+H1vFeQz4EcBX
vrDFUzfYvNyQ7G5/ZrklSkd0VDeWjqh9wAy7tol9gZ3+ZMSmNl2WqtfNBniEtFHE
EoVDuALijpc8OjPFkW3aPw8nkGem/if1Bkw2ufIB4cu5pQIq2hXS3ruy5XO2YdX8
5ShLmiAfMocRQLPDs8qTjxvU2GZ3tOEPt8FKEeYhEgy1pBX3ComY9AYc/Vg+miFT
2a28mqIlhJRUCnhG62pc4lDTURKaDWkXruUiN9N7za/bE44GFUMHgjL67SdF0Z/v
wLQoQm9iIEpvaG5zb24gPGJvYi5qb2huc29uY3J5cHRAZ21haWwuY29tPoheBBMR
CgAGBQJh4/frAAoJEO9GHje6JdywTLEA/0O4K73Ue4rqxc2y++bW7E8bu9TQT+lZ
zOUSBKy8BniLAP4zssyWe5srxVgtrEV03BURyKsyXbfh0LeS3sYmHLimdLkBDQRh
4/frEAQA///////////JD9qiIWjCNMTGYouA3BzRKQJOCIpnzHQCC76mOxObIlFK
CHmONATd75UZs806QxswKwpt8l8UN0/hNW1tUcJF5IW1dmJefsb0TELppjftawv/
XLb0Brft7jhr+1qJn6WunyQRfEsf5kkoZlHs5lOB//////////8AAgID/2p06wMD
4asA3mtrhY//B5khyHweQ648t9s/ZKOQyI949jtks1SjbzDdhGL+7NHHD0TNYKEY
1bCnIGM2+3Oouqus5MY3KhHNIkFqSLVgVZ5qQwSEuI9GrWBaLsyunPrELeUso2mQ
S/U/IT+J2Kki+t5Qu9WU3UvvQ9o0+7xUgVPPiF4EGBEKAAYFAmHj9+sACgkQ70Ye
N7ol3LAwvwD/U8mmB8MIQeEr7CDplReJy8QnBIDtxwhwtd812reGPqgBAKvY142V
CNdc1IwkcW6zNyooZ5hpjgZgpwcESfzRMN0J
=vGxW
-----END PGP PUBLIC KEY BLOCK-----

Public key CAN be shared. Simply send it to anybody who wants to send you an encrypted message or file. You can publish your public key in your blog or website, so that people do not need to ask you for the key every time.

Sending an encrypted message

Ok, let’s send our first encrypted email. We will use Public Key we have just created for Bob Johnson and imagine that we want to send an encrypted e-mail to Bob Johnson. First, we need to import public key of the recipient to the PGPTool.

  1. Copy public key to clipboard (Ctrl+C).
  2. Import public key into PGPTool – Picture 5 and 6.
Picture 5. Import Public Key from clipboard.
Picture 6. Import Public Key.

3. Encrypt the message with public key

Now we can encrypt our message with Bob Johnson’s public key (Picture 7) and send it in a plain text via any email service provider. Once Bob receives it, he will use his private key to decrypt the message and read it. For encryption go to Text > Select Recipients > Enter message > Press “Encrypt” > Copy encrypted message to clipboard.

Picture 7. Encrypting message.

When Bob receives the email containing that weird message, he will know that it’s an encrypted and should be decrypted with his private key. The process is shown on Picture 8.

Picture 8. Decrypting message.

If the passphrase was entered correctly, the original message will show up in the “Decryption result” part of the window (Picture 9). Passphrase is important because it ensures that only authorized person has access to the private key. Otherwise anyone who has the private key can decrypt.

Picture 9. Decryption outcome.

Summary

We have learned how to send and encrypted email. And you can use same software and technique to encrypt regular files as well (we describe it in this article). Let’s summarize sending/receiving of encrypted e-mail.

  1. Create key pair.
  2. Obtain public key of the recipient.
  3. Encrypt your message with the recipient’s public key.
  4. Attach your public key to the email so that recipient can reply back to you with the encrypted message.
  5. Send message.
  6. Decrypt reply with your private key.