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>
|
- **Generate a new GPG key pair:**
|
||||||
<code>gpg --full-generate-key</code>
|
```bash
|
||||||
|
gpg --full-generate-key
|
||||||
|
```
|
||||||
|
|
||||||
<p><strong>List all keys in your GPG keyring:</strong></p>
|
- **List all keys in your GPG keyring:**
|
||||||
<code>gpg --list-keys</code>
|
```bash
|
||||||
|
gpg --list-keys
|
||||||
|
```
|
||||||
|
|
||||||
<p><strong>List all the secret keys in your GPG keyring:</strong></p>
|
- **List all the secret keys in your GPG keyring:**
|
||||||
<code>gpg --list-secret-keys</code>
|
```bash
|
||||||
|
gpg --list-secret-keys
|
||||||
|
```
|
||||||
|
|
||||||
<h2>🔒 Message Encryption and Decryption</h2>
|
## Message Encryption and Decryption 💌
|
||||||
|
|
||||||
<p><strong>Encrypt a message:</strong></p>
|
- **Encrypt a message:**
|
||||||
<code>gpg -e -u "your-email@example.com" -r "recipient@example.com" message.txt</code>
|
```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>
|
- **Decrypt a message:**
|
||||||
<code>gpg -o decrypted-message.txt -d message.txt.gpg</code>
|
```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>
|
1. **Create a tarball from the folder you want to encrypt:**
|
||||||
<li><strong>Create a tarball from the folder you want to encrypt:</strong></li>
|
```bash
|
||||||
<code>tar -czvf archive.tar.gz /path/to/folder_to_encrypt</code>
|
tar -czvf archive.tar.gz /path/to/folder_to_encrypt
|
||||||
|
```
|
||||||
|
|
||||||
<li><strong>Encrypt the tarball using GPG:</strong></li>
|
2. **Encrypt the tarball using GPG:**
|
||||||
<code>gpg -e -r your-email@example.com archive.tar.gz</code>
|
```bash
|
||||||
</ol>
|
gpg -e -r your-email@example.com archive.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
<h3>Decrypting a Folder</h3>
|
### Decrypting a Folder 🔓
|
||||||
|
|
||||||
<ol>
|
1. **Decrypt the GPG file to a tarball:**
|
||||||
<li><strong>Decrypt the GPG file to a tarball:</strong></li>
|
```bash
|
||||||
<code>gpg -o archive.tar.gz -d archive.tar.gz.gpg</code>
|
gpg -o archive.tar.gz -d archive.tar.gz.gpg
|
||||||
|
```
|
||||||
|
|
||||||
<li><strong>Extract the tarball to the original folder:</strong></li>
|
2. **Extract the tarball to the original folder:**
|
||||||
<code>tar -xzvf archive.tar.gz</code>
|
```bash
|
||||||
</ol>
|
tar -xzvf archive.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
<h2>✉️ Encrypting a Message for Yourself: [Different Method]</h2>
|
## Encrypting a message for yourself: [Different Method] 🤔
|
||||||
|
|
||||||
<ol>
|
1. **Generate a Key Pair**:
|
||||||
<li><strong>Generate a Key Pair:</strong></li>
|
```bash
|
||||||
<code>gpg --gen-key</code>
|
gpg --gen-key
|
||||||
|
```
|
||||||
|
|
||||||
<li><strong>Encrypt the Message:</strong></li>
|
2. **Encrypt the Message**:
|
||||||
<code>gpg -e -u "Your Name" -r "Your Name" message.txt</code>
|
```bash
|
||||||
|
gpg -e -u "Your Name" -r "Your Name" message.txt
|
||||||
|
```
|
||||||
|
|
||||||
<li><strong>Decrypt the Message:</strong></li>
|
3. **Decrypt the Message**:
|
||||||
<code>gpg -d message.txt.gpg</code>
|
```bash
|
||||||
</ol>
|
gpg -d message.txt.gpg
|
||||||
|
```
|
||||||
|
|
||||||
<h2>👥 Encrypting a Message for Someone Else:</h2>
|
## Encrypting a message for someone else: 🤝
|
||||||
|
|
||||||
<ol>
|
1. **Import Their Public Key**:
|
||||||
<li><strong>Import Their Public Key:</strong></li>
|
```bash
|
||||||
<code>gpg --import theirkey.gpg</code>
|
gpg --import theirkey.gpg
|
||||||
|
```
|
||||||
|
|
||||||
<li><strong>Encrypt the Message:</strong></li>
|
2. **Encrypt the Message**:
|
||||||
<code>gpg -e -u "Your Name" -r "Their Name" message.txt</code>
|
```bash
|
||||||
</ol>
|
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>
|
Feel free to upload this to your GitHub repository!
|
||||||
<code>gpg --export -a "Your Name" > public.key</code>
|
|
||||||
</ol>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
Loading…
Reference in new issue