soatok/age
Composer 安装命令:
composer require soatok/age
包简介
Pure-PHP implementation of the age file encryption format (c2sp.org/age)
README 文档
README
PHP implementation of age. Supports post-quantum cryptography.
Tip
The author pronounces it [aɡe̞] with a hard g, like GIF, and it's
always spelled lowercase.
Installation
composer require soatok/age
Usage
We ecommend using Hybrid ML-KEM-768 + X25519 for identities and recipients.
<?php use Soatok\Age\Age; use Soatok\Age\Hybrid\Mlkem768X25519\{ HybridIdentity, HybridRecipient }; // Generate a new identity for Alice: $alice = HybridIdentity::generate(); // You can use HybridRecipient::fromString(/* age public key goes here */); to load a public key // For a runnable example, we generate Bob's on-the-fly: $bobSecret = HybridIdentity::generate(); $bob = $bobSecret->getRecipient(); // Sample encryption: $aliceToBob = Age::encrypt('hello bob', [$bob]); // Example decryption: $bobReads = Age::decrypt($aliceToBob, [$bobSecret]); var_dump($bobReads); // string(9) "hello bob" // With optional ASCII armor: $bobToAlice = Age::encryptArmored('hi alice!', [$alice->getRecipient()]); $aliceReads = Age::decrypt($bobToAlice, [$alice]); var_dump($aliceReads); // string(9) "hi alice!"
Limitations
- P-256 is currently not implemented
- Nor is Hybrid ML-KEM-768 + P-256
- Scrypt is not supported
License
This PHP port of age is released under the same 3-Clause BSD license as the Go implementation.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 18
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2026-04-11