parent
3d2db1ffaf
commit
83a943d550
@ -1,106 +1,101 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>GPG Cheatsheet 🛡️</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
h1, h2, h3 {
|
||||
color: #333;
|
||||
}
|
||||
code {
|
||||
background-color: #f0f0f0;
|
||||
padding: 10px;
|
||||
border-radius: 4px;
|
||||
display: block;
|
||||
}
|
||||
pre {
|
||||
background-color: #f8f8f8;
|
||||
padding: 10px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>GPG Cheatsheet 🛡️</h1>
|
||||
```markdown
|
||||
# GPG Cheatsheet 🔐
|
||||
|
||||
<h2>🔑 Key Management</h2>
|
||||
## Key Management 🔑
|
||||
|
||||
<p><strong>Generate a new GPG key pair:</strong></p>
|
||||
<code>gpg --full-generate-key</code>
|
||||
- **Generate a new GPG key pair:**
|
||||
```bash
|
||||
gpg --full-generate-key
|
||||
```
|
||||
|
||||
<p><strong>List all keys in your GPG keyring:</strong></p>
|
||||
<code>gpg --list-keys</code>
|
||||
- **List all keys in your GPG keyring:**
|
||||
```bash
|
||||
gpg --list-keys
|
||||
```
|
||||
|
||||
<p><strong>List all the secret keys in your GPG keyring:</strong></p>
|
||||
<code>gpg --list-secret-keys</code>
|
||||
- **List all the secret keys in your GPG keyring:**
|
||||
```bash
|
||||
gpg --list-secret-keys
|
||||
```
|
||||
|
||||
<h2>🔒 Message Encryption and Decryption</h2>
|
||||
## Message Encryption and Decryption 💌
|
||||
|
||||
<p><strong>Encrypt a message:</strong></p>
|
||||
<code>gpg -e -u "your-email@example.com" -r "recipient@example.com" message.txt</code>
|
||||
- **Encrypt a message:**
|
||||
```bash
|
||||
gpg -e -u "your-email@example.com" -r "recipient@example.com" message.txt
|
||||
```
|
||||
This creates `message.txt.gpg`.
|
||||
|
||||
<p><strong>Decrypt a message:</strong></p>
|
||||
<code>gpg -o decrypted-message.txt -d message.txt.gpg</code>
|
||||
- **Decrypt a message:**
|
||||
```bash
|
||||
gpg -o decrypted-message.txt -d message.txt.gpg
|
||||
```
|
||||
This creates `decrypted-message.txt`.
|
||||
|
||||
<h2>📁 GPG Folder Encryption Cheat Sheet</h2>
|
||||
## GPG Folder Encryption Cheat Sheet 📂
|
||||
|
||||
<h3>Encrypting a Folder</h3>
|
||||
### Encrypting a Folder 🔒
|
||||
|
||||
<ol>
|
||||
<li><strong>Create a tarball from the folder you want to encrypt:</strong></li>
|
||||
<code>tar -czvf archive.tar.gz /path/to/folder_to_encrypt</code>
|
||||
1. **Create a tarball from the folder you want to encrypt:**
|
||||
```bash
|
||||
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>
|
||||
</ol>
|
||||
2. **Encrypt the tarball using GPG:**
|
||||
```bash
|
||||
gpg -e -r your-email@example.com archive.tar.gz
|
||||
```
|
||||
|
||||
<h3>Decrypting a Folder</h3>
|
||||
### Decrypting a Folder 🔓
|
||||
|
||||
<ol>
|
||||
<li><strong>Decrypt the GPG file to a tarball:</strong></li>
|
||||
<code>gpg -o archive.tar.gz -d archive.tar.gz.gpg</code>
|
||||
1. **Decrypt the GPG file to a tarball:**
|
||||
```bash
|
||||
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>
|
||||
</ol>
|
||||
2. **Extract the tarball to the original folder:**
|
||||
```bash
|
||||
tar -xzvf archive.tar.gz
|
||||
```
|
||||
|
||||
<h2>✉️ Encrypting a Message for Yourself: [Different Method]</h2>
|
||||
## Encrypting a message for yourself: [Different Method] 🤔
|
||||
|
||||
<ol>
|
||||
<li><strong>Generate a Key Pair:</strong></li>
|
||||
<code>gpg --gen-key</code>
|
||||
1. **Generate a Key Pair**:
|
||||
```bash
|
||||
gpg --gen-key
|
||||
```
|
||||
|
||||
<li><strong>Encrypt the Message:</strong></li>
|
||||
<code>gpg -e -u "Your Name" -r "Your Name" message.txt</code>
|
||||
2. **Encrypt the Message**:
|
||||
```bash
|
||||
gpg -e -u "Your Name" -r "Your Name" message.txt
|
||||
```
|
||||
|
||||
<li><strong>Decrypt the Message:</strong></li>
|
||||
<code>gpg -d message.txt.gpg</code>
|
||||
</ol>
|
||||
3. **Decrypt the Message**:
|
||||
```bash
|
||||
gpg -d message.txt.gpg
|
||||
```
|
||||
|
||||
<h2>👥 Encrypting a Message for Someone Else:</h2>
|
||||
## Encrypting a message for someone else: 🤝
|
||||
|
||||
<ol>
|
||||
<li><strong>Import Their Public Key:</strong></li>
|
||||
<code>gpg --import theirkey.gpg</code>
|
||||
1. **Import Their Public Key**:
|
||||
```bash
|
||||
gpg --import theirkey.gpg
|
||||
```
|
||||
|
||||
<li><strong>Encrypt the Message:</strong></li>
|
||||
<code>gpg -e -u "Your Name" -r "Their Name" message.txt</code>
|
||||
</ol>
|
||||
2. **Encrypt the Message**:
|
||||
```bash
|
||||
gpg -e -u "Your Name" -r "Their Name" message.txt
|
||||
```
|
||||
|
||||
<h2>🔄 Exporting & Importing Keys</h2>
|
||||
## Exporting & Importing Keys 📤📥
|
||||
|
||||
<p><strong>Exporting Your Public Key:</strong></p>
|
||||
1. **Exporting Your Public Key:**
|
||||
```bash
|
||||
gpg --list-keys
|
||||
gpg --export -a "Your Name" > public.key
|
||||
```
|
||||
|
||||
<ol>
|
||||
<li><strong>List your keys to find the one you want to export:</strong></li>
|
||||
<code>gpg --list-keys</code>
|
||||
```
|
||||
|
||||
<li><strong>Export it to a file:</strong></li>
|
||||
<code>gpg --export -a "Your Name" > public.key</code>
|
||||
</ol>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Feel free to upload this to your GitHub repository!
|
||||
|
Loading…
Reference in new issue