You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.7 KiB
2.7 KiB
<html>
<head>
</head>
GPG Cheatsheet 🛡️
🔑 Key Management
Generate a new GPG key pair:
gpg --full-generate-key
List all keys in your GPG keyring:
gpg --list-keys
List all the secret keys in your GPG keyring:
gpg --list-secret-keys
🔒 Message Encryption and Decryption
Encrypt a message:
gpg -e -u "your-email@example.com" -r "recipient@example.com" message.txt
Decrypt a message:
gpg -o decrypted-message.txt -d message.txt.gpg
📁 GPG Folder Encryption Cheat Sheet
Encrypting a Folder
- Create a tarball from the folder you want to encrypt:
tar -czvf archive.tar.gz /path/to/folder_to_encrypt
<li><strong>Encrypt the tarball using GPG:</strong></li>
<code>gpg -e -r your-email@example.com archive.tar.gz</code>
Decrypting a Folder
- Decrypt the GPG file to a tarball:
gpg -o archive.tar.gz -d archive.tar.gz.gpg
<li><strong>Extract the tarball to the original folder:</strong></li>
<code>tar -xzvf archive.tar.gz</code>
✉️ Encrypting a Message for Yourself: [Different Method]
- Generate a Key Pair:
gpg --gen-key
<li><strong>Encrypt the Message:</strong></li>
<code>gpg -e -u "Your Name" -r "Your Name" message.txt</code>
<li><strong>Decrypt the Message:</strong></li>
<code>gpg -d message.txt.gpg</code>
👥 Encrypting a Message for Someone Else:
- Import Their Public Key:
gpg --import theirkey.gpg
<li><strong>Encrypt the Message:</strong></li>
<code>gpg -e -u "Your Name" -r "Their Name" message.txt</code>
🔄 Exporting & Importing Keys
Exporting Your Public Key:
- List your keys to find the one you want to export:
gpg --list-keys
<li><strong>Export it to a file:</strong></li>
<code>gpg --export -a "Your Name" > public.key</code>