Crate rcgen

source ·
Expand description

Rust X.509 certificate generation utility

This crate provides a way to generate self signed X.509 certificates.

The most simple way of using this crate is by calling the generate_simple_self_signed function. For more customization abilities, construct a CertificateParams and a key pair to call CertificateParams::signed_by() or CertificateParams::self_signed().

§Example

extern crate rcgen;
use rcgen::{generate_simple_self_signed, CertifiedKey};
// Generate a certificate that's valid for "localhost" and "hello.world.example"
let subject_alt_names = vec!["hello.world.example".to_string(),
	"localhost".to_string()];

let CertifiedKey { cert, key_pair } = generate_simple_self_signed(subject_alt_names).unwrap();
println!("{}", cert.pem());
println!("{}", key_pair.serialize_pem());

Structs§

Enums§

Statics§

Traits§

  • A private key that is not directly accessible, but can be used to sign messages

Functions§

Type Aliases§