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
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 --versionNote 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.
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-keyFollow the prompts:
- Key type: Select
(1) RSA and RSA(default) - Key size: Enter
4096for maximum security - Key expiration: Choose
1y(1 year) for security best practices - Real name: Enter your full name
- Email address: Enter your email address
- Comment: Optional (e.g., "Work key" or "Personal key")
- 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.
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-keysExample 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.ascStore this file securely offline. You'll need it to revoke your key if necessary.
Manage Keys with Kleopatra
Use Kleopatra's graphical interface to manage your PGP keys.
Using Kleopatra GUI
- Launch Kleopatra from the Kali menu: Applications > 08 - Crypto Tools > Kleopatra
- Your newly created key should appear in the certificate list
- Right-click your key and select Certify Certificate to self-sign it
- Go to File > Export Certificates to File
- Select your key and choose Export Secret Key to include private key
- Save as
mykey-backup.ascin 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!
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 ABCDEF12Upload via Kleopatra
- In Kleopatra, select your certificate
- Click Tools > Publish on Server
- Select
keys.openpgp.orgfrom the dropdown - Click Publish
- 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.
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
- Launch Thunderbird
- Go to Account Settings (menu button → Settings → Account Settings)
- Select your email account from the left panel
- Click End-to-End Encryption
- Under OpenPGP Key, click Add Key
- Select your key from the list and click OK
- Check Enable OpenPGP support (experimental)
- 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.
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_IDImport from File
If your recipient sends you their public key file:
gpg --import recipient-public-key.ascVerify 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.
Send Encrypted Emails
Compose and send secure, encrypted messages to your contacts.
Composing Encrypted Email
- Click Write to compose a new message
- Address it to your recipient (must have their public key imported)
- Look for the OpenPGP security indicator in the composition window
- Click the padlock icon to enable encryption
- (Optional) Click the pen icon to enable digital signature
- 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
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