rage is a simple, modern, and secure file encryption tool, using the age format. It features small explicit keys, post-quantum support, no config options, and UNIX-style composability.
The format specification is at age-encryption.org/v1. age was designed by @Benjojo and @FiloSottile.
The reference interoperable Go implementation is available at filippo.io/age.
Hardware PIV tokens such as YubiKeys are supported through the age-plugin-yubikey plugin.
For more plugins, implementations, tools, and integrations, check out the awesome age list.
| Environment | CLI command |
|---|---|
| Cargo (Rust 1.87+) | cargo install rage |
| Homebrew (macOS or Linux) | brew install rage |
| MacPorts | port install rage |
| Alpine Linux (edge) | apk add rage |
| Arch Linux | pacman -S rage-encryption |
| Debian | Debian packages |
| NixOS | Add to config: environment.systemPackages = [ pkgs.rage ];Or run nix-env -i rage |
| openSUSE Tumbleweed | zypper install rage-encryption |
| Ubuntu 22.04+ | Debian packages |
| FreeBSD | pkg install rage-encryption |
| Scoop (Windows) | scoop bucket add mainscoop install main/rage |
On Windows, Linux, and macOS, you can use the pre-built binaries.
Help from new packagers is very welcome. Please use the package name
rage; the fallback package namerage-encryptionshould be used only when there are unavoidable name conflicts in package systems that use global namespaces. Do not rename any binaries; instead use your package system's conflicting package mechanism to prevent installation of both packages at once.
Usage: rage [--encrypt] (-r RECIPIENT | -R PATH)... [-i IDENTITY] [-a] [-o OUTPUT] [INPUT]
rage [--encrypt] --passphrase [-a] [-o OUTPUT] [INPUT]
rage --decrypt [-i IDENTITY] [-o OUTPUT] [INPUT]
Arguments:
[INPUT] Path to a file to read from.
Options:
-h, --help Print this help message and exit.
-V, --version Print version info and exit.
-e, --encrypt Encrypt the input (the default).
-d, --decrypt Decrypt the input.
-p, --passphrase Encrypt with a passphrase instead of recipients.
--max-work-factor <WF> Maximum work factor to allow for passphrase decryption.
-a, --armor Encrypt to a PEM encoded format.
-r, --recipient <RECIPIENT> Encrypt to the specified RECIPIENT. May be repeated.
-R, --recipients-file <PATH> Encrypt to the recipients listed at PATH. May be repeated.
-i, --identity <IDENTITY> Use the identity file at IDENTITY. May be repeated.
-j <PLUGIN-NAME> Use age-plugin-PLUGIN-NAME in its default mode as an identity.
-o, --output <OUTPUT> Write the result to the file at path OUTPUT.
INPUT defaults to standard input, and OUTPUT defaults to standard output.
If OUTPUT exists, it will be overwritten.
RECIPIENT can be:
- An age public key, as generated by rage-keygen ("age1...").
- An SSH public key ("ssh-ed25519 AAAA...", "ssh-rsa AAAA...").
PATH is a path to a file containing age recipients, one per line
(ignoring "#" prefixed comments and empty lines). "-" may be used to
read recipients from standard input.
IDENTITY is a path to a file with age identities, one per line
(ignoring "#" prefixed comments and empty lines), or to an SSH key file.
Passphrase-encrypted age identity files can be used as identity files.
Multiple identities may be provided, and any unused ones will be ignored.
"-" may be used to read identities from standard input.
Files can be encrypted to multiple recipients by repeating -r/--recipient.
Every recipient will be able to decrypt the file.
$ rage -o example.png.age -r age1uvscypafkkxt6u2gkguxet62cenfmnpc0smzzlyun0lzszfatawq4kvf2u \
-r age1ex4ty8ppg02555at009uwu5vlk5686k3f23e7mac9z093uvzfp8sxr5jum example.pngMultiple recipients can also be listed one per line in one or more files passed
with the -R/--recipients-file flag.
$ cat recipients.txt
# Alice
age1ql3z7hjy54pw3hyww5ayyfg7zqgvc7w3j2elw8zmrj2kg5sfn9aqmcac8p
# Bob
age1lggyhqrw2nlhcxprm67z43rta597azn8gknawjehu9d9dl0jq3yqqvfafg
$ rage -R recipients.txt example.jpg > example.jpg.age
If the argument to -R (or -i) is -, the file is read from standard input.
rage-keygen generates hybrid post-quantum keys by default, which are secure
against future quantum computer attacks. You can also request this explicitly
with the --pq flag. To generate classic keys, use rage-keygen --pq=false.
Post-quantum identities start with AGE-SECRET-KEY-PQ-1... and recipients with
age1pq1.... The recipients are unfortunately ~2000 characters long.
$ rage-keygen -o key.txt
$ rage-keygen -y key.txt > recipient.txt
$ rage -R recipient.txt example.jpg > example.jpg.age
$ rage -d -i key.txt example.jpg.age > example.jpg
Support for post-quantum keys is built into rage v0.13.0 and later. Alternatively,
the age-plugin-pq binary can be installed and placed in $PATH to add support
to any version and implementation of age that supports plugins. Recipients will
work out of the box, while identities will have to be converted to plugin
identities with age-plugin-pq -identity.
rage and rage-mount listen to the environment variable AGE_PQC_REQUIRED, which
sets a policy for usage of post-quantum recipients and identities. It accepts the
following values:
YESenforces two policies:- Reject encryption unless every recipient (including recipients provided by a
plugin) uses post-quantum stanzas (i.e. with the
postquantumlabel). This policy is hard (fail-closed). - Reject decryption of files with headers containing any recognized classic recipient stanza. This policy is soft (fail-open on unknown stanza kinds).
- Reject encryption unless every recipient (including recipients provided by a
plugin) uses post-quantum stanzas (i.e. with the
ALLOW_ONLY_DECRYPTenforces only the encryption policy.ALLOW_INSECURE(the default when the variable is unset or empty) does not enforce any policy.
By default, a warning is printed to standard error if AGE_PQC_REQUIRED=YES would have
rejected the operation. Set AGE_PQC_WARNINGS=VERBOSE for more detail about the
violation, or AGE_PQC_WARNINGS=SILENCE_I_KNOW_ITS_NOT_SAFE to suppress warnings
without changing the policy.
Files can be encrypted with a passphrase by using -p/--passphrase. By default
rage will automatically generate a secure passphrase.
$ rage -p -o example.png.age example.png
Type passphrase (leave empty to autogenerate a secure one): [hidden]
Using an autogenerated passphrase:
kiwi-general-undo-bubble-dwarf-dizzy-fame-side-sunset-sibling
$ rage -d example.png.age >example.png
Type passphrase: [hidden]If a binary named pinentry is available in $PATH, it will be used to ask the
user for a passphrase. The PINENTRY_PROGRAM environment variable can be used
to set the binary name or path to use. If a pinentry binary is not available,
or PINENTRY_PROGRAM is set to the empty string, rage will fall back to the
CLI instead.
If an identity file passed to -i/--identity is a passphrase-encrypted age
file, it will be automatically decrypted.
$ rage -p -o key.age <(rage-keygen)
Public key: age1pq1pd[... 1950 more characters ...]
Type passphrase (leave empty to autogenerate a secure one): [hidden]
Using an autogenerated passphrase:
flash-bean-celery-network-curious-flower-salt-amateur-fence-giant
$ rage -r age1pq1pd[...] secrets.txt > secrets.txt.age
$ rage -d -i key.age secrets.txt.age > secrets.txt
Type passphrase: [hidden]
Passphrase-protected identity files are not necessary for most use cases, where access to the encrypted identity file implies access to the whole system. However, they can be useful if the identity file is stored remotely.
As a convenience feature, rage also supports encrypting to ssh-rsa and
ssh-ed25519 SSH public keys, and decrypting with the respective private key
file. (ssh-agent is not supported.)
$ rage -R ~/.ssh/id_ed25519.pub example.png > example.png.age
$ rage -d -i ~/.ssh/id_ed25519 example.png.age > example.png
Note that SSH key support employs more complex cryptography, and embeds a public key tag in the encrypted file, making it possible to track files that are encrypted to a specific public key.
When building with Cargo, you can configure rage using --no-default-features
and --features comma,separated,flags to enable or disable the following
feature flags:
-
mountenables therage-mounttool, which can mount age-encrypted TAR or ZIP archives as read-only. It is currently only usable on Unix systems (as it relies onlibfuse), and has an MSRV of 1.88. -
ssh(enabled by default) enables support for reusing existing SSH key files for age encryption. -
unstableenables in-development functionality. Anything behind this feature flag has no stability or interoperability guarantees.
Applications wishing to use rage as a library should use the age
crate, which rage is built on top of.
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
