Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
age — 一个简单、现代且安全的加密工具(及 Go 库),具有简短明确的密钥、无配置选项,以及 UNIX 风格的可组合性。 | Kitploit
工具/GitHubGitHub/filosottile/age
加密/解密工具数据恢复密码学隐私保护实用工具与框架
GitHubfilosottile/age

age

一个简单、现代且安全的加密工具(及 Go 库),具有简短明确的密钥、无配置选项,以及 UNIX 风格的可组合性。

查看仓库
23.2k6605个月前Kitploit 审核通过

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享
网站

age 徽标,罗马圣彼得大教堂穹顶的线框,文字为:age,文件加密

Go Reference man page C2SP specification

age 是一款简单、现代且安全的文件加密工具、格式和 Go 库。

它的特点是:小巧明确的密钥、后量子支持、无配置选项以及 UNIX 风格的可组合性。

root@kitploit:~
$ age-keygen -o key.txt
Public key: age1ql3z7hjy54pw3hyww5ayyfg7zqgvc7w3j2elw8zmrj2kg5sfn9aqmcac8p
$ tar cvz ~/data | age -r age1ql3z7hjy54pw3hyww5ayyfg7zqgvc7w3j2elw8zmrj2kg5sfn9aqmcac8p > data.tar.gz.age
$ age --decrypt -i key.txt data.tar.gz.age > data.tar.gz

📜 格式规范位于 age-encryption.org/v1。age 由 @benjojo 和 @FiloSottile 设计。

🦀 一个可互操作的替代 Rust 实现位于 github.com/str4d/rage。

🌍 Typage 是一个 TypeScript 实现。它可在浏览器、Node.js、Deno 和 Bun 中运行。

🔑 通过 age-plugin-yubikey 插件可支持 YubiKey 等硬件 PIV 令牌。

✨ 如需更多插件、实现、工具和集成,请查看 awesome age 列表。

💬 作者将其读作 [aɡe̞],发音时带一个硬 g,就像 GIF 一样,并且它总是小写拼写。

安装

在 Windows、Linux、macOS 和 FreeBSD 上,你可以使用预构建的二进制文件。

root@kitploit:~
https://dl.filippo.io/age/latest?for=linux/amd64
https://dl.filippo.io/age/v1.3.1?for=darwin/arm64
...

如果你下载预构建的二进制文件,可以验证它们的 Sigsum 证明。

如果你的系统有受支持的 Go 版本,你可以从源码构建。

root@kitploit:~
go install filippo.io/age/cmd/...@latest

非常欢迎新的打包者提供帮助。

用法

完整文档请阅读 age(1) 手册页。

root@kitploit:~
Usage:
    age [--encrypt] (-r RECIPIENT | -R PATH)... [--armor] [-o OUTPUT] [INPUT]
    age [--encrypt] --passphrase [--armor] [-o OUTPUT] [INPUT]
    age --decrypt [-i PATH]... [-o OUTPUT] [INPUT]

Options:
    -e, --encrypt               Encrypt the input to the output. Default if omitted.
    -d, --decrypt               Decrypt the input to the output.
    -o, --output OUTPUT         Write the result to the file at path OUTPUT.
    -a, --armor                 Encrypt to a PEM encoded format.
    -p, --passphrase            Encrypt with a passphrase.
    -r, --recipient RECIPIENT   Encrypt to the specified RECIPIENT. Can be repeated.
    -R, --recipients-file PATH  Encrypt to recipients listed at PATH. Can be repeated.
    -i, --identity PATH         Use the identity file at PATH. Can be repeated.

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 generated by age-keygen ("age1...")
or an SSH public key ("ssh-ed25519 AAAA...", "ssh-rsa AAAA...").

Recipient files contain one or more recipients, one per line. Empty lines
and lines starting with "#" are ignored as comments. "-" may be used to
read recipients from standard input.

Identity files contain one or more secret keys ("AGE-SECRET-KEY-1..."),
one per line, or an SSH key. Empty lines and lines starting with "#" are
ignored as comments. Passphrase encrypted age files can be used as
identity files. Multiple key files can be provided, and any unused ones
will be ignored. "-" may be used to read identities from standard input.

When --encrypt is specified explicitly, -i can also be used to encrypt to an
identity file symmetrically, instead or in addition to normal recipients.

INPUT 默认为标准输入,OUTPUT 默认为标准输出。 如果 OUTPUT 已存在,它将被覆盖。

RECIPIENT 可以是 age-keygen 生成的 age 公钥("age1...") 或 SSH 公钥("ssh-ed25519 AAAA..."、"ssh-rsa AAAA...")。

接收者文件包含一个或多个接收者,每行一个。空行和以 "#" 开头的行将作为注释被忽略。可以使用 "-" 从标准输入读取接收者。

身份文件包含一个或多个密钥("AGE-SECRET-KEY-1..."),每行一个,或一个 SSH 密钥。空行和以 "#" 开头的行将作为注释被忽略。口令加密的 age 文件可以用作身份文件。可以提供多个密钥文件,任何未使用的文件将被忽略。可以使用 "-" 从标准输入读取身份。

当显式指定 --encrypt 时,也可以使用 -i 将文件对称加密到身份文件,以替代或补充普通接收者。

多接收者

通过重复使用 -r/--recipient 可以将文件加密给多个接收者。每个接收者都可以解密该文件。

root@kitploit:~
$ age -o example.jpg.age -r age1ql3z7hjy54pw3hyww5ayyfg7zqgvc7w3j2elw8zmrj2kg5sfn9aqmcac8p \
    -r age1lggyhqrw2nlhcxprm67z43rta597azn8gknawjehu9d9dl0jq3yqqvfafg example.jpg

接收者文件

多个接收者也可以每行一个地列在一个或多个文件中,通过 -R/--recipients-file 标志传入。

root@kitploit:~
$ cat recipients.txt
# Alice
age1ql3z7hjy54pw3hyww5ayyfg7zqgvc7w3j2elw8zmrj2kg5sfn9aqmcac8p
# Bob
age1lggyhqrw2nlhcxprm67z43rta597azn8gknawjehu9d9dl0jq3yqqvfafg
$ age -R recipients.txt example.jpg > example.jpg.age

如果 -R(或 -i)的参数是 -,则从标准输入读取文件。

后量子密钥

要生成能够抵御未来量子计算机攻击的混合后量子密钥,请结合 age-keygen 使用 -pq 标志。这在未来可能会成为默认设置。

后量子身份以 AGE-SECRET-KEY-PQ-1... 开头,接收者以 age1pq1... 开头。遗憾的是,接收者大约有 2000 个字符长。

root@kitploit:~
$ age-keygen -pq -o key.txt
$ age-keygen -y key.txt > recipient.txt
$ age -R recipient.txt example.jpg > example.jpg.age
$ age -d -i key.txt example.jpg.age > example.jpg

对后量子密钥的支持内置于 age v1.3.0 及更高版本。或者,可以安装 age-plugin-pq 二进制文件并将其放入 $PATH,以便为任何支持插件的 age 版本和实现添加支持。接收者开箱即用,而身份则需要通过 age-plugin-pq -identity 转换为插件身份。

口令

使用 -p/--passphrase 可以用口令加密文件。默认情况下,age 会自动生成一个安全的口令。受口令保护的文件会在解密时被自动检测。

root@kitploit:~
$ age -p secrets.txt > secrets.txt.age
Enter passphrase (leave empty to autogenerate a secure one):
Using the autogenerated passphrase "release-response-step-brand-wrap-ankle-pair-unusual-sword-train".
$ age -d secrets.txt.age > secrets.txt
Enter passphrase:

受口令保护的密钥文件

如果传递给 -i 的身份文件是一个口令加密的 age 文件,它将被自动解密。

root@kitploit:~
$ age-keygen | age -p > key.age
Public key: age1yhm4gctwfmrpz87tdslm550wrx6m79y9f2hdzt0lndjnehwj0ukqrjpyx5
Enter passphrase (leave empty to autogenerate a secure one):
Using the autogenerated passphrase "hip-roast-boring-snake-mention-east-wasp-honey-input-actress".
$ age -r age1yhm4gctwfmrpz87tdslm550wrx6m79y9f2hdzt0lndjnehwj0ukqrjpyx5 secrets.txt > secrets.txt.age
$ age -d -i key.age secrets.txt.age > secrets.txt
Enter passphrase for identity file "key.age":

在大多数用例中,访问加密的身份文件就意味着访问整个系统,因此受口令保护的身份文件并不是必需的。不过,如果身份文件存储在远程位置,它们会很有用。

SSH 密钥

作为一项便捷功能,age 还支持加密到 ssh-rsa 和 ssh-ed25519 SSH 公钥,并使用相应的私钥文件解密。(不支持 ssh-agent。)

root@kitploit:~
$ age -R ~/.ssh/id_ed25519.pub example.jpg > example.jpg.age
$ age -d -i ~/.ssh/id_ed25519 example.jpg.age > example.jpg

请注意,SSH 密钥支持使用更复杂的密码学,并在加密文件中嵌入公钥标签,从而可以追踪加密到特定公钥的文件。

加密给 GitHub 用户

结合 SSH 密钥支持与 -R,你可以轻松地将文件加密到 GitHub 个人资料中列出的 SSH 密钥。

root@kitploit:~
$ curl https://github.com/benjojo.keys | age -R - example.jpg > example.jpg.age

请记住,人们可能不会长期保护 SSH 密钥,因为它们仅用于身份验证时可以撤销,而且保存在 YubiKey 上的 SSH 密钥无法用于解密文件。

检查加密文件

age-inspect 命令可以在不解密的情况下显示加密文件的元数据,包括接收者类型、是否使用后量子加密以及负载大小。

root@kitploit:~
$ age-inspect secrets.age
secrets.age is an age file, version "age-encryption.org/v1".

This file is encrypted to the following recipient types:
  - "mlkem768x25519"

This file uses post-quantum encryption.

Size breakdown (assuming it decrypts successfully):

    Header                      1627 bytes
    Encryption overhead           32 bytes
    Payload                       42 bytes
                        -------------------
    Total                       1701 bytes

对于脚本编写,请使用 --json 获取机器可读的输出。

下载工具
Homebrew(macOS 或 Linux) brew install age
MacPorts port install age
Windows winget install --id FiloSottile.age
Alpine Linux v3.15+ apk add age
Arch Linux pacman -S age
Debian 12+ (Bookworm) apt install age
Debian 11 (Bullseye) apt install age/bullseye-backports (启用 backports 以使用 age v1.0.0+)
Fedora 33+ dnf install age
Gentoo Linux emerge app-crypt/age
Guix System guix package -i age
NixOS / Nix nix-env -i age
openSUSE Tumbleweed zypper install age
Ubuntu 22.04+ apt install age
Void Linux xbps-install age
FreeBSD pkg install age (security/age)
OpenBSD 6.7+ pkg_add age (security/age)
Chocolatey(Windows) choco install age.portable
Scoop(Windows) scoop bucket add extras && scoop install age