|
|
@ -1,3 +1,4 @@
|
|
|
|
|
|
|
|
Here is the GPG cheatsheet converted to Markdown:
|
|
|
|
|
|
|
|
|
|
|
|
```markdown
|
|
|
|
```markdown
|
|
|
|
# GPG Cheatsheet 🔐
|
|
|
|
# GPG Cheatsheet 🔐
|
|
|
@ -5,16 +6,19 @@
|
|
|
|
## Key Management 🔑
|
|
|
|
## Key Management 🔑
|
|
|
|
|
|
|
|
|
|
|
|
- **Generate a new GPG key pair:**
|
|
|
|
- **Generate a new GPG key pair:**
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
```bash
|
|
|
|
gpg --full-generate-key
|
|
|
|
gpg --full-generate-key
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
- **List all keys in your GPG keyring:**
|
|
|
|
- **List all keys in your GPG keyring:**
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
```bash
|
|
|
|
gpg --list-keys
|
|
|
|
gpg --list-keys
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
- **List all the secret keys in your GPG keyring:**
|
|
|
|
- **List all the secret keys in your GPG keyring:**
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
```bash
|
|
|
|
gpg --list-secret-keys
|
|
|
|
gpg --list-secret-keys
|
|
|
|
```
|
|
|
|
```
|
|
|
@ -22,15 +26,19 @@
|
|
|
|
## Message Encryption and Decryption 💌
|
|
|
|
## Message Encryption and Decryption 💌
|
|
|
|
|
|
|
|
|
|
|
|
- **Encrypt a message:**
|
|
|
|
- **Encrypt a message:**
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
```bash
|
|
|
|
gpg -e -u "your-email@example.com" -r "recipient@example.com" message.txt
|
|
|
|
gpg -e -u "your-email@example.com" -r "recipient@example.com" message.txt
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
This creates `message.txt.gpg`.
|
|
|
|
This creates `message.txt.gpg`.
|
|
|
|
|
|
|
|
|
|
|
|
- **Decrypt a message:**
|
|
|
|
- **Decrypt a message:**
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
```bash
|
|
|
|
gpg -o decrypted-message.txt -d message.txt.gpg
|
|
|
|
gpg -o decrypted-message.txt -d message.txt.gpg
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
This creates `decrypted-message.txt`.
|
|
|
|
This creates `decrypted-message.txt`.
|
|
|
|
|
|
|
|
|
|
|
|
## GPG Folder Encryption Cheat Sheet 📂
|
|
|
|
## GPG Folder Encryption Cheat Sheet 📂
|
|
|
@ -38,11 +46,13 @@
|
|
|
|
### Encrypting a Folder 🔒
|
|
|
|
### Encrypting a Folder 🔒
|
|
|
|
|
|
|
|
|
|
|
|
1. **Create a tarball from the folder you want to encrypt:**
|
|
|
|
1. **Create a tarball from the folder you want to encrypt:**
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
```bash
|
|
|
|
tar -czvf archive.tar.gz /path/to/folder_to_encrypt
|
|
|
|
tar -czvf archive.tar.gz /path/to/folder_to_encrypt
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
2. **Encrypt the tarball using GPG:**
|
|
|
|
2. **Encrypt the tarball using GPG:**
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
```bash
|
|
|
|
gpg -e -r your-email@example.com archive.tar.gz
|
|
|
|
gpg -e -r your-email@example.com archive.tar.gz
|
|
|
|
```
|
|
|
|
```
|
|
|
@ -50,11 +60,13 @@
|
|
|
|
### Decrypting a Folder 🔓
|
|
|
|
### Decrypting a Folder 🔓
|
|
|
|
|
|
|
|
|
|
|
|
1. **Decrypt the GPG file to a tarball:**
|
|
|
|
1. **Decrypt the GPG file to a tarball:**
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
```bash
|
|
|
|
gpg -o archive.tar.gz -d archive.tar.gz.gpg
|
|
|
|
gpg -o archive.tar.gz -d archive.tar.gz.gpg
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
2. **Extract the tarball to the original folder:**
|
|
|
|
2. **Extract the tarball to the original folder:**
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
```bash
|
|
|
|
tar -xzvf archive.tar.gz
|
|
|
|
tar -xzvf archive.tar.gz
|
|
|
|
```
|
|
|
|
```
|
|
|
@ -62,16 +74,19 @@
|
|
|
|
## Encrypting a message for yourself: [Different Method] 🤔
|
|
|
|
## Encrypting a message for yourself: [Different Method] 🤔
|
|
|
|
|
|
|
|
|
|
|
|
1. **Generate a Key Pair**:
|
|
|
|
1. **Generate a Key Pair**:
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
```bash
|
|
|
|
gpg --gen-key
|
|
|
|
gpg --gen-key
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
2. **Encrypt the Message**:
|
|
|
|
2. **Encrypt the Message**:
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
```bash
|
|
|
|
gpg -e -u "Your Name" -r "Your Name" message.txt
|
|
|
|
gpg -e -u "Your Name" -r "Your Name" message.txt
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
3. **Decrypt the Message**:
|
|
|
|
3. **Decrypt the Message**:
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
```bash
|
|
|
|
gpg -d message.txt.gpg
|
|
|
|
gpg -d message.txt.gpg
|
|
|
|
```
|
|
|
|
```
|
|
|
@ -79,11 +94,13 @@
|
|
|
|
## Encrypting a message for someone else: 🤝
|
|
|
|
## Encrypting a message for someone else: 🤝
|
|
|
|
|
|
|
|
|
|
|
|
1. **Import Their Public Key**:
|
|
|
|
1. **Import Their Public Key**:
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
```bash
|
|
|
|
gpg --import theirkey.gpg
|
|
|
|
gpg --import theirkey.gpg
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
2. **Encrypt the Message**:
|
|
|
|
2. **Encrypt the Message**:
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
```bash
|
|
|
|
gpg -e -u "Your Name" -r "Their Name" message.txt
|
|
|
|
gpg -e -u "Your Name" -r "Their Name" message.txt
|
|
|
|
```
|
|
|
|
```
|
|
|
@ -91,11 +108,10 @@
|
|
|
|
## Exporting & Importing Keys 📤📥
|
|
|
|
## Exporting & Importing Keys 📤📥
|
|
|
|
|
|
|
|
|
|
|
|
1. **Exporting Your Public Key:**
|
|
|
|
1. **Exporting Your Public Key:**
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
```bash
|
|
|
|
gpg --list-keys
|
|
|
|
gpg --list-keys
|
|
|
|
gpg --export -a "Your Name" > public.key
|
|
|
|
gpg --export -a "Your Name" > public.key
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
Let me know if you need any changes!
|
|
|
|
|
|
|
|
|
|
|
|
Feel free to upload this to your GitHub repository!
|
|
|
|
|
|
|
|