diff --git a/README.md b/README.md index 6a0844ca..bf6fae2a 100644 --- a/README.md +++ b/README.md @@ -7,14 +7,15 @@ Simple Rust library to generate X.509 certificates. ```Rust -use rcgen::generate_simple_self_signed; +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 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()); +let CertifiedKey { cert, key_pair } = generate_simple_self_signed(subject_alt_names).unwrap(); +println!("{}", cert.pem()); +println!("{}", key_pair.serialize_pem()); ``` ## Trying it out with openssl