Skip to content

Passphrase Mode

By the end of this chapter you will be able to lock a file with a passphrase alone — no key pair at all — and to say exactly when that convenience is the weaker choice.

The mode itself

age -p -o note.txt.age note.txt

age asks for a passphrase, asks you to confirm it, and locks the file. Opening it is the mirror image:

age -d -o note.txt note.txt.age

age recognises the passphrase stanza in the header and prompts. Under the hood (chapter 2), the file key is wrapped with a key derived from your passphrase by scrypt, tuned to take about a second of deliberate work — a tax a guesser must pay on every single guess.

The lab ran this in transcript t05, including the failure: a wrong passphrase gets age: error: incorrect passphrase, exit code 1, and — this matters — no output file at all. age never writes half-decrypted plaintext for you to mistake for the real thing.

Let age invent the passphrase

Press Enter at the prompt, empty, and age generates a passphrase for you and prints it once:

age: using autogenerated passphrase
"erupt-display-cushion-shadow-purse-suspect-pony-favorite-stove-forward"

(Transcript t10; the lab then opened the file with exactly that string.) Ten random words beat almost any passphrase a human invents, because humans invent patterns. The catch is obvious: the passphrase now exists only where you write it down. A password manager is the right home. A sticky note is at least an honest one; your memory, for a ten-word string you typed once, is not.

When passphrase mode is the weaker choice

Passphrase mode is genuinely useful — for a file you will open on a machine with no keys, for a one-off secret to a person who has no age key, where the passphrase travels by a different road than the file. But know its three weaknesses, because they are structural:

  • A passphrase is only as strong as its guessability. Key pairs are random all the way down. Passphrases are chosen by people, and people choose birthdays, song titles and the dog. scrypt slows guessing; it does not save a guessable secret. The autogenerated words exist precisely because of this paragraph.
  • One passphrase per file, no sharing arithmetic. A key-locked file opens for any of several people, each with their own key (chapter 7). A passphrase file opens for whoever knows the one passphrase — so it gets told, forwarded, reused, and cannot be withdrawn from one person without changing it for everyone.
  • No revocation. If a passphrase leaks, every copy of every file under it is open, forever. If an identity leaks, chapter 5's handover still leaves already-sent copies exposed — but new files can move to a new key while the old passphrase files cannot move at all without re-sharing the new passphrase to the same leaky world.

And one mechanical note: passphrase mode refuses company. age -p cannot be combined with -r recipients in the same file — a file is locked to keys, or to a passphrase, never both. If a file needs to open for your key and a phrase, it must be locked twice, as two files.

The verdict this guide teaches: keys for anything that will live longer than the conversation; passphrases for the genuinely one-off, and then let age invent them.