pub fn generate_simple_self_signed(
    subject_alt_names: Vec<String>
) -> Certificate
Expand description

KISS function to generate a self signed certificate

Given a set of domain names you want your certificate to be valid for, this function fills in the other generation parameters with reasonable defaults and generates a self signed certificate as output.

Example

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);
// The certificate is now valid for localhost and the domain "hello.world.example"
println!("{}", cert.serialize_pem());
println!("{}", cert.serialize_private_key_pem());