38个版本

0.13.1 2024年4月5日
0.13.0 2024年3月28日
0.12.1 2024年1月26日
0.12.0 2023年12月16日
0.2.0 2019年1月10日

#12 in 加密学

Download history · Rust 包仓库 154229/week @ 2024-04-26 · Rust 包仓库 145758/week @ 2024-05-03 · Rust 包仓库 159105/week @ 2024-05-10 · Rust 包仓库 156599/week @ 2024-05-17 · Rust 包仓库 157639/week @ 2024-05-24 · Rust 包仓库 156134/week @ 2024-05-31 · Rust 包仓库 146541/week @ 2024-06-07 · Rust 包仓库 142546/week @ 2024-06-14 · Rust 包仓库 155296/week @ 2024-06-21 · Rust 包仓库 132209/week @ 2024-06-28 · Rust 包仓库 136845/week @ 2024-07-05 · Rust 包仓库 145916/week @ 2024-07-12 · Rust 包仓库 155932/week @ 2024-07-19 · Rust 包仓库 157050/week @ 2024-07-26 · Rust 包仓库 174078/week @ 2024-08-02 · Rust 包仓库 154581/week @ 2024-08-09 · Rust 包仓库

669,611 每月下载量
用于 1,055 个crate (239 直接)

MIT/Apache

160KB
3.5K SLoC

rcgen

docs crates.io dependency status

一个简单的Rust库,用于生成X.509证书。

use rcgen::generate_simple_self_signed;
let subject_alt_names = vec!["hello.world.example".to_string(),
	"localhost".to_string()];

let cert = generate_simple_self_signed(subject_alt_names).unwrap();
// The certificate is now valid for localhost and the domain "hello.world.example"
println!("{}", cert.serialize_pem().unwrap());
println!("{}", cert.serialize_private_key_pem());

使用openssl尝试

你可以这样做

cargo run
openssl x509 -in certs/cert.pem -text -noout

对于调试,将PEM格式的文本粘贴到服务中非常有用。

使用quinn尝试

你可以使用rcgen与quinn crate一起使用。完整的命令集是

cargo run
cd ../quinn
cargo run --example server -- --cert ../rcgen/certs/cert.pem --key ../rcgen/certs/key.pem ./
cargo run --example client -- --ca ../rcgen/certs/cert.der https://localhost:4433/README.md

MSRV

MSRV策略是努力支持7个月前的Rust版本。

许可证

此crate根据MIT许可证和Apache许可证(版本2.0)的条款分发,任选其一。

有关详细信息,请参阅LICENSE

你的贡献的许可证

除非你明确说明,否则任何有意提交给作品并由你定义的Apache-2.0许可证包括的贡献,应如上所述双重许可,不附加任何额外的条款或条件。

依赖关系

~7–28MB
~663K SLoC