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.
1.9 KiB
1.9 KiB
# GPG Cheatsheet 🔐
## Key Management 🔑
- **Generate a new GPG key pair:**
```bash
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
This creates
message.txt.gpg
. -
Decrypt a message:
gpg -o decrypted-message.txt -d message.txt.gpg
This creates
decrypted-message.txt
.
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
-
Encrypt the tarball using GPG:
gpg -e -r your-email@example.com archive.tar.gz
Decrypting a Folder 🔓
-
Decrypt the GPG file to a tarball:
gpg -o archive.tar.gz -d archive.tar.gz.gpg
-
Extract the tarball to the original folder:
tar -xzvf archive.tar.gz
Encrypting a message for yourself: [Different Method] 🤔
-
Generate a Key Pair:
gpg --gen-key
-
Encrypt the Message:
gpg -e -u "Your Name" -r "Your Name" message.txt
-
Decrypt the Message:
gpg -d message.txt.gpg
Encrypting a message for someone else: 🤝
-
Import Their Public Key:
gpg --import theirkey.gpg
-
Encrypt the Message:
gpg -e -u "Your Name" -r "Their Name" message.txt
Exporting & Importing Keys 📤📥
- Exporting Your Public Key:
gpg --list-keys gpg --export -a "Your Name" > public.key
Feel free to upload this to your GitHub repository!