158 lines
6.2 KiB
HTML
158 lines
6.2 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>age 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">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="42" height="42" viewBox="0 0 24 24" class="home-icon"><path fill="currentColor" d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/></svg>
|
|
</a>
|
|
<h1 class="blog-page-title">age Cheatsheet</h1>
|
|
</div>
|
|
</div>
|
|
<div class="blog-post-container">
|
|
<div class="blog-posts-container" style="max-width: 900px; margin: 0 auto;">
|
|
<div class="blog-post">
|
|
<div class="blog-post-content">
|
|
<p><a href="index.html">← Back to cheatsheets</a></p>
|
|
<p><a href="../index.html">← Home</a></p>
|
|
<hr>
|
|
<p>age is a simple, modern file encryption tool. It's designed to replace GPG for file encryption with a simpler, safer design. Uses modern cryptography (X25519, ChaCha20Poly1305, HKDF).</p>
|
|
<hr>
|
|
<h2>Key Generation</h2>
|
|
<ul>
|
|
<li>age-keygen -o key.txt - Generate a new keypair</li>
|
|
</ul>
|
|
<ul>
|
|
<li>age-keygen -y key.txt - Extract public key from keypair</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Public key format: age1...</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Private key format: AGE-SECRET-KEY-1...</li>
|
|
</ul>
|
|
<hr>
|
|
<h2>Encryption</h2>
|
|
<ul>
|
|
<li>age -r age1... -o encrypted.age file.txt - Encrypt with recipient public key</li>
|
|
</ul>
|
|
<ul>
|
|
<li>age -r age1... -r age1... file.txt - Encrypt to multiple recipients</li>
|
|
</ul>
|
|
<ul>
|
|
<li>age -p -o encrypted.age file.txt - Encrypt with passphrase</li>
|
|
</ul>
|
|
<ul>
|
|
<li>cat file.txt | age -r age1... > encrypted.age - Encrypt from stdin</li>
|
|
</ul>
|
|
<hr>
|
|
<h2>Decryption</h2>
|
|
<ul>
|
|
<li>age -d -i key.txt -o decrypted.txt encrypted.age - Decrypt with key file</li>
|
|
</ul>
|
|
<ul>
|
|
<li>age -d encrypted.age - Decrypt with passphrase (prompts)</li>
|
|
</ul>
|
|
<ul>
|
|
<li>age -d -i key.txt encrypted.age - Decrypt to stdout</li>
|
|
</ul>
|
|
<ul>
|
|
<li>cat encrypted.age | age -d -i key.txt - Decrypt from stdin</li>
|
|
</ul>
|
|
<hr>
|
|
<h2>Options</h2>
|
|
<ul>
|
|
<li>-r, --recipient - Recipient public key (can use multiple times)</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-i, --identity - Identity (private key) file</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-o, --output - Output file</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-p, --passphrase - Encrypt with passphrase instead of key</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-d, --decrypt - Decrypt mode</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-y, --yubikey - Use YubiKey for decryption</li>
|
|
</ul>
|
|
<hr>
|
|
<h2>Common Examples</h2>
|
|
<h3>Generate Keypair</h3>
|
|
<pre><code>age-keygen -o ~/.age/key.txt</code></pre>
|
|
<p>Create a new keypair and save to file.</p>
|
|
<h3>Encrypt File</h3>
|
|
<pre><code>age -r age1abc123... -o secret.age secret.txt</code></pre>
|
|
<p>Encrypt file to recipient.</p>
|
|
<h3>Decrypt File</h3>
|
|
<pre><code>age -d -i ~/.age/key.txt -o secret.txt secret.age</code></pre>
|
|
<p>Decrypt file with private key.</p>
|
|
<h3>Passphrase Encryption</h3>
|
|
<pre><code>age -p -o backup.age backup.tar.gz</code></pre>
|
|
<p>Encrypt with passphrase (no key needed).</p>
|
|
<h3>Multiple Recipients</h3>
|
|
<pre><code>age -r age1... -r age1... -o shared.age document.txt</code></pre>
|
|
<p>Encrypt so multiple people can decrypt.</p>
|
|
<hr>
|
|
<h2>Tips</h2>
|
|
<ul>
|
|
<li>age is simpler and faster than GPG for file encryption</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Public keys are safe to share (age1... format)</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Keep private keys secure (AGE-SECRET-KEY-1... format)</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use passphrase mode for quick encryption without key management</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Multiple recipients can decrypt the same file</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Great for encrypting backups, secrets, and sensitive files</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script async type="text/javascript" src="../blog/analytics.js"></script>
|
|
<script src="../theme.js"></script>
|
|
</body>
|
|
</html>
|
|
|