Cyber Services / All lessons / CEH — Ethical Hacking / Secure Email with PGP in Thunderbird

Secure Email with PGP in Thunderbird

Module 111 of 130 · 5 min read · Free to read

MODULES ↓ Command blocks have a COPY button

Complete guide with GPG key generation, Kleopatra management, and keyserver upload

PGP (Pretty Good Privacy) is the gold standard for email encryption. This comprehensive guide covers creating keys with GPG, managing them with Kleopatra, uploading to keyservers, and sending encrypted emails in Thunderbird — all on Kali Linux.

What you'll need:

  • Kali Linux (fully updated)
  • Thunderbird email client
  • GnuPG and Kleopatra installed
1

Install Required Software on Kali Linux

Ensure all necessary PGP tools are installed on your Kali system.

Install GnuPG and Kleopatra

Open a terminal and run the following commands:

# Update package lists
sudo apt update

# Install GnuPG, Kleopatra, and Thunderbird
sudo apt install -y gnupg kleopatra thunderbird

# Verify installation
gpg --version
kleopatra --version

Note on Kali Linux

Kali Linux includes GnuPG by default, but Kleopatra (the GUI key manager) may need to be installed separately. Thunderbird is not installed by default in minimal Kali installations.

2

Create PGP Keys with GPG

Generate your PGP key pair directly using GPG (recommended over OpenSSL for PGP).

Generate PGP Key Pair

Run the interactive key generation command:

gpg --full-generate-key

Follow the prompts:

  1. Key type: Select (1) RSA and RSA (default)
  2. Key size: Enter 4096 for maximum security
  3. Key expiration: Choose 1y (1 year) for security best practices
  4. Real name: Enter your full name
  5. Email address: Enter your email address
  6. Comment: Optional (e.g., "Work key" or "Personal key")
  7. Passphrase: Create a strong, memorable passphrase

Security Warning

Your passphrase protects your private key. If compromised, anyone can decrypt your messages and impersonate you. Use a strong passphrase with mixed case, numbers, and symbols.

3

Verify and List Your Keys

Confirm your key was created successfully and note your key ID.

List Your Keys

# List public keys
gpg --list-keys

# List private keys  
gpg --list-secret-keys

Example output:

/home/kali/.gnupg/pubring.kbx
-----------------------------
pub   rsa4096 2024-01-15 [SC] [expires: 2025-01-15]
      ABCDEF1234567890ABCDEF1234567890ABCDEF12
uid           [ultimate] Your Name <your.email@example.com>
sub   rsa4096 2024-01-15 [E] [expires: 2025-01-15]

Your Key ID is the last 8 characters: ABCDEF12

Create Revocation Certificate

Create a revocation certificate in case your key is compromised:

gpg --gen-revoke ABCDEF1234567890ABCDEF1234567890ABCDEF12 > ~/.gnupg/revoke.asc

Store this file securely offline. You'll need it to revoke your key if necessary.

4

Manage Keys with Kleopatra

Use Kleopatra's graphical interface to manage your PGP keys.

Using Kleopatra GUI

  1. Launch Kleopatra from the Kali menu: Applications > 08 - Crypto Tools > Kleopatra
  2. Your newly created key should appear in the certificate list
  3. Right-click your key and select Certify Certificate to self-sign it
  4. Go to File > Export Certificates to File
  5. Select your key and choose Export Secret Key to include private key
  6. Save as mykey-backup.asc in a secure location

Backup Your Keys!

Store your private key backup on an encrypted USB drive or secure offline storage. If you lose your private key, you cannot decrypt messages sent to you!

5

Upload Your Public Key to a Keyserver

Make your public key discoverable by uploading it to a public keyserver.

Upload via Command Line

Use the terminal to upload your key (replace KEY_ID with your actual key ID):

# Upload to keys.openpgp.org (recommended)
gpg --keyserver hkps://keys.openpgp.org --send-keys ABCDEF12

# Alternative: Upload to Ubuntu keyserver
gpg --keyserver hkp://keyserver.ubuntu.com --send-keys ABCDEF12

Upload via Kleopatra

  1. In Kleopatra, select your certificate
  2. Click Tools > Publish on Server
  3. Select keys.openpgp.org from the dropdown
  4. Click Publish
  5. Verify success in the status window

Keyserver Best Practices

keys.openpgp.org is the modern, privacy-focused keyserver that requires email verification. This prevents key spamming and ensures key authenticity.

6

Configure Thunderbird for PGP

Set up Thunderbird to use your PGP keys for email encryption (Thunderbird 78+ has built-in OpenPGP support).

Configure Email Account

  1. Launch Thunderbird
  2. Go to Account Settings (menu button → Settings → Account Settings)
  3. Select your email account from the left panel
  4. Click End-to-End Encryption
  5. Under OpenPGP Key, click Add Key
  6. Select your key from the list and click OK
  7. Check Enable OpenPGP support (experimental)
  8. Click OK to save

Thunderbird Built-in PGP

Modern Thunderbird (78+) includes native OpenPGP support, eliminating the need for the Enigmail extension. Your GPG keys are automatically detected from the system keyring.

7

Import Recipient's Public Key

Before sending encrypted email, you need your recipient's public key.

Import from Keyserver

# Search for recipient's key
gpg --keyserver hkps://keys.openpgp.org --search-keys recipient@example.com

# Import specific key by ID
gpg --keyserver hkps://keys.openpgp.org --recv-keys RECIPIENT_KEY_ID

Import from File

If your recipient sends you their public key file:

gpg --import recipient-public-key.asc

Verify Key Authenticity

Always verify public keys through trusted channels (phone call, in-person, verified fingerprint). Never assume a key from a keyserver belongs to the intended person without verification.

8

Send Encrypted Emails

Compose and send secure, encrypted messages to your contacts.

Composing Encrypted Email

  1. Click Write to compose a new message
  2. Address it to your recipient (must have their public key imported)
  3. Look for the OpenPGP security indicator in the composition window
  4. Click the padlock icon to enable encryption
  5. (Optional) Click the pen icon to enable digital signature
  6. Write your message and click Send

How Encryption Works

Thunderbird automatically:

  • Uses your recipient's public key to encrypt the message
  • Uses your private key to sign the message (if selected)
  • Only your recipient can decrypt it with their private key
  • Recipients can verify your signature with your public key

9

Best Practices and Security Tips

Maintain strong security hygiene for your PGP implementation.

Security Best Practices

  • Key expiration: Renew keys annually and update keyservers
  • Strong passphrases: Use 12+ character passphrases with mixed case, numbers, symbols
  • Hardware security: Consider YubiKey for storing private keys securely
  • Regular backups: Keep encrypted backups of your private keys
  • Software updates: Keep Kali, Thunderbird, and GPG updated

Critical Reminders

  • Never share your private key or passphrase with anyone
  • Email metadata (subject, sender, recipient) is NOT encrypted
  • Always verify recipient keys before sending sensitive information
  • Store revocation certificates securely for emergency key revocation
Modules (130) ← CEH — Ethical Hacking