age for Mere Mortals
Some files should not travel naked. A tax return on its way to the accountant, a backup leaving the house, a note with a password in it: each is one lost laptop or one mis-sent message away from being read by the wrong person. age (pronounced ah-ghe, and short for Actually Good Encryption) locks a file so that only the people named for it can open it. You give it a file and a recipient — a short public key — and it hands back a locked file that is safe to store, send and forget about until the day it is needed.
This guide explains how that locking works, how to make your own key pair, how to encrypt for one person or a whole team, how passphrases and the SSH keys you may already have fit in, and how to prove — not hope — that a locked file still opens. The limits are stated plainly, and the biggest one is short enough to say now: whoever holds the matching secret key can open the file, and nobody else can, including you, if you lose it.
The rules that govern everything here are stated in chapter 1 and repeated wherever they bite: encrypt your own files; keep your identity key like a house key; a lost identity means lost files. The lab obeyed the first of those strictly. Every encryption in this guide is between keys the lab itself generated, on files the lab itself wrote, on one machine.
The lab behind this guide ran the real
thing: age 1.3.2, the official release
build, on a small Linux machine. Against
it the lab generated key pairs (including
a post-quantum one), encrypted a note to
one recipient and decrypted it back
byte-for-byte, wrapped the same note in
text armor for pasting into a message,
read the locked file's header with
age-inspect, encrypted to two recipients
and opened the file as each of them in
turn, kept a team's public keys in a
recipients file, used a throwaway SSH
key as both recipient and identity, ran
passphrase mode right and with a
deliberately wrong passphrase (it refused,
and wrote nothing), let age invent a
passphrase and used it, converted an
identity file back to its public key,
streamed tar archives through age in both
directions, and tried to open a file with
a stranger's key to watch it fail. Every
key in the lab was generated for the lab
and is worthless; they are printed in
full in the transcripts, which is exactly
what you must never do with a real one.
What the lab could not do, it did not
fake. It had no hardware security key to
test, so the plugin chapter describes the
hardware-key landscape from the projects'
documentation and labels it as such. The
comparison tools in chapter 14 are
characterised, not benchmarked.
criteria.md keeps the full ledger of
what was run and what was only read.
What this guide covers
- What age is — the mental model: files locked to named recipients, the three small tools, and the rules that are part of the tool, not an afterthought
- The moving parts — recipients and identities, the random file key inside every locked file, the header and its stanzas, and armoring
- Installing age — the package manager routes, the official release, and proving the install with a version number
- Your first encryption — a key pair, one note, one lock, one unlock, checked byte-for-byte
- Key pairs — keeping the identity safe — what an identity file is, where it should live, backups of the key itself, and what a lost or leaked key means
- Passphrase mode — locking a file with a passphrase alone, the autogenerated passphrase, and when this is the weaker choice
- Encrypting for several people — several recipients on one file, and why adding a person later means re-encrypting
- Recipients files — a team's public keys in one shareable file, comments and all
- SSH keys as recipients — the SSH key pair you may already have, used as an age recipient and identity
- Decrypting and verifying — round trips proven with hashes, reading a locked file's header before opening it, and the failure messages, decoded
- age in scripts and backups — pipes in both directions, tar through age, exit codes, and the golden rule of testing the restore
- Plugins and hardware keys — the plugin system, security keys and smartcards that hold an identity, and the post-quantum keys this build has — carefully labelled as read, not run
- Recipes — a backup that leaves the house, a secret in an email, a shared team drop file, a key handover when someone leaves
- The neighbours — GnuPG, OpenSSL and 7-Zip encryption: what each does that age doesn't, and vice versa
- Limits — no signatures, no key directory, the filename and the size still showing, and the lost-key cliff edge, stated plainly
- Troubleshooting — "no identity matched", the wrong passphrase, the file that is not an age file, and the traps this guide's lab fell into so you don't have to
- Glossary — the terms, collected in one place
What it doesn't cover
Encrypting other people's files without their knowledge, recovering a file whose key is gone (chapter 15 explains why no chapter can), and defeating anyone else's encryption are not harder chapters of this book; they are not in the book at all. Running a key-distribution service for an organisation — directories, rollout, policy — is pointed at, not taught; this guide stays with one person, their files, and the people they choose to share them with.
How to use this guide
Read chapter 1 for the model and the
rules, and chapter 2 before encrypting
anything you care about — knowing which
part holds what turns later confusion
into a named problem. Chapter 4 makes
your first key pair and locks your first
note in the same sitting as the install;
use practice files until the round trip
feels boring. Chapter 5 is not the
optional chapter: decide where your
identity lives and how it is itself
backed up before real files depend on
it. The lab's transcripts live in
age-lab/transcripts/; its notes are
examples/lab-notes.txt and its command
summary examples/commands.txt.
Part of the series
This guide is one of the For Mere Mortals guides: plain-language guides to the tools programmers and makers use.
Related guides:
License
The writing in this guide is licensed under CC BY 4.0. Code examples and lab scripts are licensed under the MIT License.