100 lines
5.6 KiB
HTML
100 lines
5.6 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self'; font-src 'self' data:; img-src 'self' data:; connect-src 'self'; base-uri 'self'; form-action 'self' https://defcon.social https://bsky.app;">
|
||
<meta http-equiv="X-Content-Type-Options" content="nosniff">
|
||
<link rel="stylesheet" href="../assets/css/style.css">
|
||
<link rel="icon" type="image/x-icon" href="../favicon.ico">
|
||
<script>
|
||
// Apply theme immediately to prevent flash
|
||
(function() {
|
||
const theme = localStorage.getItem('theme') ||
|
||
(window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
|
||
document.documentElement.setAttribute('data-theme', theme);
|
||
})();
|
||
</script>
|
||
<title>gpg Cheatsheet - Launch Pad</title>
|
||
</head>
|
||
<body>
|
||
<button class="theme-toggle" id="themeToggle" aria-label="Toggle dark mode">
|
||
<svg class="theme-icon theme-icon-moon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path></svg>
|
||
<svg class="theme-icon theme-icon-sun" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display: none;"><circle cx="12" cy="12" r="5"></circle><line x1="12" y1="1" x2="12" y2="3"></line><line x1="12" y1="21" x2="12" y2="23"></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line><line x1="1" y1="12" x2="3" y2="12"></line><line x1="21" y1="12" x2="23" y2="12"></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line></svg>
|
||
</button>
|
||
<br/><br/>
|
||
<div class="name">
|
||
__ _______________________ _________._________________________
|
||
\_ _____/ \______ \ / _ \ / _____/ / _____/ | | \_ _____/
|
||
| __) | _/ / /_\ \ / \ ___ / \ ___ | | | __)_
|
||
| \ | | \ / | \ \ \_\ \ \ \_\ \ | |___ | \
|
||
\___ / |____|_ / \____|__ / \______ / \______ / |_______ \ /_______ /
|
||
\/ \/ \/ \/ \/ \/ \/
|
||
</div>
|
||
<div class="blog-page-header">
|
||
<div class="blog-header-content">
|
||
<a href="/cheatsheets" class="back-link" title="Back to Cheatsheets">
|
||
← Back to Cheatsheets
|
||
</a>
|
||
<h1 class="blog-page-title">gpg Cheatsheet</h1>
|
||
</div>
|
||
</div>
|
||
<div class="blog-posts-container">
|
||
<div class="blog-post-content">
|
||
<p>
|
||
Quick reference for <code>gpg</code> (GNU Privacy Guard), used for encryption, signing, and key management following the OpenPGP standard.
|
||
</p>
|
||
|
||
<h2>Key management</h2>
|
||
<ul>
|
||
<li><code>gpg --full-generate-key</code> – interactive key generation.</li>
|
||
<li><code>gpg --list-keys</code> / <code>gpg --list-secret-keys</code> – list public/secret keys.</li>
|
||
<li><code>gpg --delete-key <ID></code> – delete a public key.</li>
|
||
<li><code>gpg --delete-secret-key <ID></code> – delete a secret key.</li>
|
||
</ul>
|
||
|
||
<h2>Export / import keys</h2>
|
||
<ul>
|
||
<li><code>gpg --export -a <ID> > public.asc</code> – export public key (ASCII armored).</li>
|
||
<li><code>gpg --export-secret-keys -a <ID> > secret.asc</code> – export secret key (backup only).</li>
|
||
<li><code>gpg --import public.asc</code> – import a key.</li>
|
||
<li><code>gpg --recv-key <ID></code> – fetch from keyserver (if configured).</li>
|
||
</ul>
|
||
|
||
<h2>Encrypt / decrypt</h2>
|
||
<ul>
|
||
<li><code>gpg -e -r <recipient> file</code> – encrypt to recipient’s key.</li>
|
||
<li><code>gpg -d file.gpg</code> – decrypt a file.</li>
|
||
<li><code>echo "secret" | gpg -e -r <recipient> > secret.txt.gpg</code> – encrypt from stdin.</li>
|
||
</ul>
|
||
|
||
<h2>Signing</h2>
|
||
<ul>
|
||
<li><code>gpg -s file</code> – create a binary signature.</li>
|
||
<li><code>gpg -sa file</code> – create an ASCII-armored signature.</li>
|
||
<li><code>gpg --clear-sign file</code> – cleartext sign (visible content + signature block).</li>
|
||
<li><code>gpg --verify file.sig file</code> – verify a detached signature.</li>
|
||
</ul>
|
||
|
||
<h2>Trust and IDs</h2>
|
||
<ul>
|
||
<li><code>gpg --edit-key <ID></code> – manage key, set trust, add UIDs, etc.</li>
|
||
<li><code>gpg --fingerprint <ID></code> – show key fingerprint.</li>
|
||
<li>Verify fingerprints out-of-band (in person, chat, etc.) before trusting.</li>
|
||
</ul>
|
||
|
||
<h2>Tips</h2>
|
||
<ul>
|
||
<li>Use a modern key type (ed25519 or cv25519) where available.</li>
|
||
<li>Back up your secret key and revoke certificate somewhere safe.</li>
|
||
<li>Combine <code>gpg</code> with <code>pass</code> and <code>git</code> for a simple password manager.</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<script async type="text/javascript" src="../blog/analytics.js"></script>
|
||
<script src="../theme.js"></script>
|
||
</body>
|
||
</html>
|
||
|
||
|