30 releases

Uses new Rust 2021

0.10.0 Sep 29, 2022
0.9.3 Jul 16, 2022
0.9.2 Feb 21, 2022
0.8.14 Oct 14, 2021
0.2.0 Jan 10, 2019

#9 in Cryptography

Download history 36276/week @ 2022-08-15 31531/week @ 2022-08-22 34527/week @ 2022-08-29 33834/week @ 2022-09-05 38367/week @ 2022-09-12 40144/week @ 2022-09-19 40515/week @ 2022-09-26 43992/week @ 2022-10-03 40595/week @ 2022-10-10 43152/week @ 2022-10-17 46243/week @ 2022-10-24 45325/week @ 2022-10-31 49434/week @ 2022-11-07 50549/week @ 2022-11-14 48320/week @ 2022-11-21 54394/week @ 2022-11-28

204,630 downloads per month
Used in 402 crates (96 directly)

MIT/Apache

79KB
1.5K SLoC

rcgen

docs crates.io dependency status

Simple Rust library to generate X.509 certificates.

extern crate rcgen;
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());

Trying it out with openssl

You can do this:

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

For debugging, pasting the PEM formatted text to this service is very useful.

Trying it out with quinn

You can use rcgen together with the quinn crate. The whole set of commands is:

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

The MSRV policy is to strive for supporting 6-month old Rust versions.

License

This crate is distributed under the terms of both the MIT license and the Apache License (Version 2.0), at your option.

See LICENSE for details.

License of your contributions

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.

Dependencies

~5.5–7.5MB
~204K SLoC