What is PGP

(Wikipedia) Pretty Good Privacy (PGP) is an encryption program that provides cryptographic privacy and authentication for data communication. PGP is used for signing, encrypting, and decrypting texts, e-mails, files, directories, and whole disk partitions and to increase the security of e-mail communications. Phil Zimmermann developed PGP in 1991.

Get Started with PGP

This guide is meant for linux users (i will add MacOS and Windows in the future) using the gpg (GNU Pricacy Guard) package.

1. Generate Your Key Pair

First, create your public and private keys:

gpg --full-generate-key

For just getting started:

2. List Your Keys

Verify your key was created:

gpg --list-keys

3. Export Your Public Key

gpg --armor --export your@email.com

Share your public key with people who want to send you encrypted messages:

You can then share the contents of public-key.asc with others.

gpg --armor --export your@email.com > public-key.asc

4. Import Someone's Public Key

Before you can encrypt a message for someone, you need their public key:

gpg --import their-public-key.asc

5. Encrypt a Message

Encrypt a message for someone (you'll need their email address from their key):

echo "Your secret message here" | gpg --armor --encrypt --recipient their@email.com

Or encrypt a file:

gpg --armor --encrypt --recipient their@email.com message.txt

The encrypted output starts with -----BEGIN PGP MESSAGE----- and can be copy-pasted into a chat.

6. Decrypt a Message

When you receive an encrypted message, decrypt it with:

gpg --decrypt encrypted-message.asc

Or paste the encrypted text directly:

echo "-----BEGIN PGP MESSAGE-----
...
-----END PGP MESSAGE-----" | gpg --decrypt

You'll be prompted for your passphrase.

Quick Reference

Command Purpose
gpg --list-keys List all public keys
gpg --list-secret-keys List your private keys
gpg --delete-key EMAIL Delete a public key
gpg --armor --export EMAIL Export public key to terminal

Security Tips