Debian Codegraph @

doc/age.1.ronn

raw
1 age(1) -- simple, modern, and secure file encryption
2 ====================================================
3
4 ## SYNOPSIS
5
6 `age` [`--encrypt`] (`-r` <RECIPIENT> | `-R` <PATH>)... [`--armor`] [`-o` <OUTPUT>] [<INPUT>]<br>
7 `age` [`--encrypt`] `--passphrase` [`--armor`] [`-o` <OUTPUT>] [<INPUT>]<br>
8 `age` `--decrypt` [`-i` <PATH> | `-j` <PLUGIN>]... [`-o` <OUTPUT>] [<INPUT>]<br>
9
10 ## DESCRIPTION
11
12 `age` encrypts or decrypts <INPUT> to <OUTPUT>. The <INPUT> argument is
13 optional and defaults to standard input. Only a single <INPUT> file may be
14 specified. If `-o` is not specified, <OUTPUT> defaults to standard output.
15
16 If `-p`/`--passphrase` is specified, the file is encrypted with a passphrase
17 requested interactively. Otherwise, it's encrypted to one or more
18 [RECIPIENTS][RECIPIENTS AND IDENTITIES] specified with `-r`/`--recipient` or
19 `-R`/`--recipients-file`. Every recipient can decrypt the file.
20
21 In `-d`/`--decrypt` mode, passphrase-encrypted files are detected automatically
22 and the passphrase is requested interactively. Otherwise, one or more
23 [IDENTITIES][RECIPIENTS AND IDENTITIES] specified with `-i`/`--identity` are
24 used to decrypt the file.
25
26 `age` encrypted files are binary and not malleable, with around 200 bytes of
27 overhead per recipient, plus 16 bytes every 64KiB of plaintext.
28
29 ## OPTIONS
30
31 * `-o`, `--output`=<OUTPUT>:
32 Write encrypted or decrypted file to <OUTPUT> instead of standard output.
33 If <OUTPUT> already exists it will be overwritten.
34
35 If encrypting without `--armor`, `age` will refuse to output binary to a
36 TTY. This can be forced by specifying `-` as <OUTPUT>.
37
38 * `--version`:
39 Print the version and exit.
40
41 ### Encryption options
42
43 * `-e`, `--encrypt`:
44 Encrypt <INPUT> to <OUTPUT>. This is the default.
45
46 * `-r`, `--recipient`=<RECIPIENT>:
47 Encrypt to the explicitly specified <RECIPIENT>. See the
48 [RECIPIENTS AND IDENTITIES][] section for possible recipient formats.
49
50 This option can be repeated and combined with other recipient flags,
51 and the file can be decrypted by all provided recipients independently.
52
53 * `-R`, `--recipients-file`=<PATH>:
54 Encrypt to the [RECIPIENTS][RECIPIENTS AND IDENTITIES] listed in the
55 file at <PATH>, one per line. Empty lines and lines starting with `#`
56 are ignored as comments.
57
58 If <PATH> is `-`, the recipients are read from standard input. In
59 this case, the <INPUT> argument must be specified.
60
61 This option can be repeated and combined with other recipient flags,
62 and the file can be decrypted by all provided recipients independently.
63
64 * `-p`, `--passphrase`:
65 Encrypt with a passphrase, requested interactively from the terminal.
66 `age` will offer to auto-generate a secure passphrase.
67
68 This option can't be used with other recipient flags.
69
70 * `-a`, `--armor`:
71 Encrypt to an ASCII-only "armored" encoding.
72
73 `age` armor is a strict version of PEM with type `AGE ENCRYPTED FILE`,
74 canonical "strict" Base64, no headers, and no support for leading and
75 trailing extra data.
76
77 Decryption transparently detects and decodes ASCII armoring.
78
79 * `-i`, `--identity`=<PATH>:
80 Encrypt to the [RECIPIENTS][RECIPIENTS AND IDENTITIES] corresponding to the
81 [IDENTITIES][RECIPIENTS AND IDENTITIES] listed in the file at <PATH>. This
82 is equivalent to converting the file at <PATH> to a recipients file with
83 `age-keygen -y` and then passing that to `-R`/`--recipients-file`.
84
85 For the format of <PATH>, see the definition of `-i`/`--identity` in the
86 [Decryption options][] section.
87
88 `-e`/`--encrypt` must be explicitly specified when using `-i`/`--identity`
89 in encryption mode to avoid confusion.
90
91 * `-j` <PLUGIN>:
92 Encrypt using the data-less [plugin][Plugins] <PLUGIN>.
93
94 This is equivalent to using `-i`/`--identity` with a file that contains a
95 single plugin `IDENTITY` that encodes no plugin-specific data.
96
97 `-e`/`--encrypt` must be explicitly specified when using `-j` in encryption
98 mode to avoid confusion.
99
100 ### Decryption options
101
102 * `-d`, `--decrypt`:
103 Decrypt <INPUT> to <OUTPUT>.
104
105 If <INPUT> is passphrase encrypted, it will be automatically detected
106 and the passphrase will be requested interactively. Otherwise, the
107 [IDENTITIES][RECIPIENTS AND IDENTITIES] specified with `-i`/`--identity`
108 are used.
109
110 ASCII armoring is transparently detected and decoded.
111
112 * `-i`, `--identity`=<PATH>:
113 Decrypt using the [IDENTITIES][RECIPIENTS AND IDENTITIES] at <PATH>.
114
115 <PATH> may be one of the following:
116
117 a\. A file listing [IDENTITIES][RECIPIENTS AND IDENTITIES] one per line.
118 Empty lines and lines starting with "`#`" are ignored as comments.
119
120 b\. A passphrase encrypted age file, containing
121 [IDENTITIES][RECIPIENTS AND IDENTITIES] one per line like above.
122 The passphrase is requested interactively. Note that passphrase-protected
123 identity files are not necessary for most use cases, where access to the
124 encrypted identity file implies access to the whole system.
125
126 c\. An SSH private key file, in PKCS#1, PKCS#8, or OpenSSH format.
127 If the private key is password-protected, the password is requested
128 interactively only if the SSH identity matches the file. See the
129 [SSH keys][] section for more information, including supported key types.
130
131 d\. "`-`", causing one of the options above to be read from standard input.
132 In this case, the <INPUT> argument must be specified.
133
134 This option can be repeated. Identities are tried in the order in which are
135 provided, and the first one matching one of the file's recipients is used.
136 Unused identities are ignored, but it is an error if the <INPUT> file is
137 passphrase-encrypted and `-i`/`--identity` is specified.
138
139 * `-j` <PLUGIN>:
140 Decrypt using the data-less [plugin][Plugins] <PLUGIN>.
141
142 This is equivalent to using `-i`/`--identity` with a file that contains a
143 single plugin `IDENTITY` that encodes no plugin-specific data.
144
145 ## RECIPIENTS AND IDENTITIES
146
147 `RECIPIENTS` are public values, like a public key, that a file can be encrypted
148 to. `IDENTITIES` are private values, like a private key, that allow decrypting
149 a file encrypted to the corresponding `RECIPIENT`.
150
151 ### Native keys
152
153 Native `age` key pairs are generated with age-keygen(1), and provide small
154 encodings and strong encryption based on X25519 for classic keys, and X25519 +
155 ML-KEM-768 for post-quantum hybrid keys. The post-quantum hybrid keys are secure
156 against future quantum computers and are the recommended recipient type for most
157 applications.
158
159 A hybrid `RECIPIENT` encoding begins with `age1pq1` and looks like the following:
160
161 age1pq167[... 1950 more characters ...]
162
163 A hybrid `IDENTITY` encoding begins with `AGE-SECRET-KEY-PQ-1` and looks like
164 the following:
165
166 AGE-SECRET-KEY-PQ-1K30MYPZAHAXHR22YHH27EGDVLU0QNSUH3DSV7J7NR3X6D9LHXNWSDLTV4T
167
168 A classic `RECIPIENT` encoding begins with `age1` and looks like the following:
169
170 age1gde3ncmahlqd9gg50tanl99r960llztrhfapnmx853s4tjum03uqfssgdh
171
172 A classic `IDENTITY` encoding begins with `AGE-SECRET-KEY-1` and looks like the
173 following:
174
175 AGE-SECRET-KEY-1KTYK6RVLN5TAPE7VF6FQQSKZ9HWWCDSKUGXXNUQDWZ7XXT5YK5LSF3UTKQ
176
177 A file can't be encrypted to both post-quantum and classic keys, as that would
178 defeat the post-quantum security of the encryption.
179
180 An encrypted file can't be linked to the native recipient it's encrypted to
181 without access to the corresponding identity.
182
183 ### SSH keys
184
185 As a convenience feature, `age` also supports encrypting to RSA or Ed25519
186 ssh(1) keys. RSA keys must be at least 2048 bits. This feature employs more
187 complex cryptography, and should only be used when a native key is not available
188 for the recipient. Note that SSH keys might not be protected long-term by the
189 recipient, since they are revokable when used only for authentication.
190
191 A `RECIPIENT` encoding is an SSH public key in `authorized_keys` format
192 (see the `AUTHORIZED_KEYS FILE FORMAT` section of sshd(8)), starting with
193 `ssh-rsa` or `ssh-ed25519`, like the following:
194
195 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDULTit0KUehbi[...]GU4BtElAbzh8=
196 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH9pO5pz22JZEas[...]l1uZc31FGYMXa
197
198 The comment at the end of the line, if present, is ignored.
199
200 In recipient files passed to `-R`/`--recipients-file`, unsupported but valid
201 SSH public keys are ignored with a warning, to facilitate using
202 `authorized_keys` or GitHub `.keys` files. (See [EXAMPLES][].)
203
204 An `IDENTITY` is an SSH private key _file_ passed individually to
205 `-i`/`--identity`. Note that keys held on hardware tokens such as YubiKeys
206 or accessed via ssh-agent(1) are not supported.
207
208 An encrypted file _can_ be linked to the SSH public key it was encrypted to.
209 This is so that `age` can identify the correct SSH private key before
210 requesting its password, if any.
211
212 ### Plugins
213
214 `age` can be extended through plugins. A plugin is only loaded if a corresponding
215 `RECIPIENT` or `IDENTITY` is specified. (Simply decrypting a file encrypted with
216 a plugin will not cause it to load, for security reasons among others.)
217
218 A `RECIPIENT` for a plugin named `example` starts with `age1example1`, while an
219 `IDENTITY` starts with `AGE-PLUGIN-EXAMPLE-1`. They both encode arbitrary
220 plugin-specific data, and are generated by the plugin.
221
222 When either is specified, `age` searches for `age-plugin-example` in the PATH
223 and executes it to perform the file header encryption or decryption. The plugin
224 may request input from the user through `age` to complete the operation.
225
226 Plugins can be freely mixed with other plugins or natively supported keys.
227
228 A plugin is not bound to only encrypt or decrypt files meant for or generated by
229 the plugin. For example, a plugin can be used to decrypt files encrypted to a
230 native X25519 `RECIPIENT` or even with a passphrase. Similarly, a plugin can
231 encrypt a file such that it can be decrypted without the use of any plugin.
232
233 Plugins for which the `IDENTITY`/`RECIPIENT` distinction doesn't make sense
234 (such as a symmetric encryption plugin) may generate only an `IDENTITY` and
235 instruct the user to perform encryption with the `-e`/`--encrypt` and
236 `-i`/`--identity` flags. Plugins for which the concept of separate identities
237 doesn't make sense (such as a password-encryption plugin) may instruct the user
238 to use the `-j` flag.
239
240 #### Tagged recipients
241
242 `age` can natively encrypt to recipients starting with `age1tag1` (using P-256
243 ECDH) or `age1tagpq1` (using the ML-KEM-768 + P-256 post-quantum hybrid). These
244 are intended to be the public side of private keys held in hardware.
245
246 They are directly supported to avoid the need to install the plugin, which may
247 be platform-specific, on the encrypting side.
248
249 The tag reduces privacy, by allowing an observer to correlate files with a
250 recipient (but not files amongst them without knowledge of the recipient),
251 but this is also a desirable property for hardware keys that require user
252 interaction for each decryption operation.
253
254 ## EXIT STATUS
255
256 `age` will exit 0 if and only if encryption or decryption are successful for the
257 full length of the input.
258
259 If an error occurs during decryption, partial output might still be generated,
260 but only if it was possible to securely authenticate it. No unauthenticated
261 output is ever released.
262
263 ## BACKWARDS COMPATIBILITY
264
265 Files encrypted with a stable version (not alpha, beta, or release candidate) of
266 `age`, or with any v1.0.0 beta or release candidate, will decrypt with any later
267 version of the tool.
268
269 If decrypting older files poses a security risk, doing so might cause an error
270 by default. In this case, a flag will be provided to force the operation.
271
272 ## EXAMPLES
273
274 Generate a new post-quantum identity, encrypt data, and decrypt:
275
276 $ age-keygen -pq -o key.txt
277 Public key: age1pq167[... 1950 more characters ...]
278
279 $ tar cvz ~/data | age -r age1pq167[...] > data.tar.gz.age
280
281 $ age -d -o data.tar.gz -i key.txt data.tar.gz.age
282
283 Encrypt `example.jpg` to multiple recipients and output to `example.jpg.age`:
284
285 $ age -o example.jpg.age -r age1pq167[...] -r age1pq1e3[...] example.jpg
286
287 Encrypt to a list of recipients:
288
289 $ cat > recipients.txt
290 # Alice
291 age1pq167[... 1950 more characters ...]
292 # Bob
293 age1pq1e3[... 1950 more characters ...]
294
295 $ age -R recipients.txt example.jpg > example.jpg.age
296
297 Encrypt and decrypt a file using a passphrase:
298
299 $ age -p secrets.txt > secrets.txt.age
300 Enter passphrase (leave empty to autogenerate a secure one):
301 Using the autogenerated passphrase "release-response-step-brand-wrap-ankle-pair-unusual-sword-train".
302
303 $ age -d secrets.txt.age > secrets.txt
304 Enter passphrase:
305
306 Encrypt and decrypt with a passphrase-protected identity file:
307
308 $ age-keygen | age -p > key.age
309 Public key: age1yhm4gctwfmrpz87tdslm550wrx6m79y9f2hdzt0lndjnehwj0ukqrjpyx5
310 Enter passphrase (leave empty to autogenerate a secure one):
311 Using the autogenerated passphrase "hip-roast-boring-snake-mention-east-wasp-honey-input-actress".
312
313 $ age -r age1yhm4gctwfmrpz87tdslm550wrx6m79y9f2hdzt0lndjnehwj0ukqrjpyx5 secrets.txt > secrets.txt.age
314
315 $ age -d -i key.age secrets.txt.age > secrets.txt
316 Enter passphrase for identity file "key.age":
317
318 Encrypt and decrypt with an SSH public key:
319
320 $ age -R ~/.ssh/id_ed25519.pub example.jpg > example.jpg.age
321
322 $ age -d -i ~/.ssh/id_ed25519 example.jpg.age > example.jpg
323
324 Encrypt and decrypt with age-plugin-yubikey:
325
326 $ age-plugin-yubikey # run interactive setup, generate identity file and obtain recipient
327
328 $ age -r age1yubikey1qwt50d05nh5vutpdzmlg5wn80xq5negm4uj9ghv0snvdd3yysf5yw3rhl3t secrets.txt > secrets.txt.age
329
330 $ age -d -i age-yubikey-identity-388178f3.txt secrets.txt.age
331
332 Encrypt to the SSH keys of a GitHub user:
333
334 $ curl https://github.com/benjojo.keys | age -R - example.jpg > example.jpg.age
335
336 ## SEE ALSO
337
338 age-keygen(1), age-inspect(1)
339
340 ## AUTHORS
341
342 Filippo Valsorda <[email protected]>