PGP Encryption
PGP encryption allows you to secure your communications by encrypting files, messages, and emails. This guide covers the fundamental encryption and decryption operations using both command-line and GUI tools.
Basic Encryption Concepts
PGP uses a hybrid encryption system that combines:
- Public-key (asymmetric) encryption: Uses recipient's public key to encrypt data
- Symmetric encryption: Uses a randomly generated session key for the actual file encryption
- Digital signatures: Ensures authenticity and integrity of the message
Encrypting Files
Command Line (GPG)
To encrypt a file for a specific recipient:
# Encrypt a file for a specific recipient
gpg --encrypt --recipient recipient@email.com document.txt
# This creates an encrypted file: document.txt.gpg
To encrypt and sign a file (recommended):
# Encrypt and sign a file
gpg --encrypt --sign --recipient recipient@email.com document.txt
Using GUI Applications
Kleopatra/GPG4Win:
- Right-click the file in Explorer
- Select "Sign and Encrypt"
- Choose recipient(s)
- Complete the encryption process
GPG Suite (macOS):
- Right-click the file in Finder
- Select "Services" → "OpenPGP: Encrypt File"
- Choose recipient(s)
Decrypting Files
Command Line Decryption
# Decrypt a file
gpg --decrypt encrypted-file.gpg > decrypted-file.txt
# If the file is signed, GPG will verify the signature automatically
GUI Decryption Applications
Kleopatra/GPG4Win:
- Double-click the .gpg file
- Enter your passphrase when prompted
GPG Suite (macOS):
- Double-click the encrypted file
- Enter your passphrase when prompted
Text Encryption
To encrypt text messages (e.g., for secure messaging):
# Create a text file with your message
echo "Secret message" > message.txt
# Encrypt the message
gpg --encrypt --armor --recipient recipient@email.com message.txt
# The output file (message.txt.asc) contains ASCII-armored encrypted text
# that can be copied and pasted into emails or messaging apps
Verifying Signatures
To verify a signed file:
# Verify a signature
gpg --verify document.txt.sig document.txt
Best Practices
- Always verify signatures when decrypting files from others
- Use trusted channels for initially exchanging public keys
- Sign your encrypted messages to provide authentication
- Keep your private key secure and protected by a strong passphrase
- Use ASCII armor (
--armor
flag) when sharing encrypted text via text channels
Next Steps
- Email Integration - Configure email clients for PGP
- Best Practices - Advanced security considerations
Overview
Content will be added soon.
Key Points
- Important information about PGP Encryption
- Step-by-step instructions
- Best practices