Skip to content

Commit 72369d3

Browse files
ghenrydjc
authored andcommitted
Update README.md example to match what's in lib.rs
1 parent 1b4a355 commit 72369d3

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77
Simple Rust library to generate X.509 certificates.
88

99
```Rust
10-
use rcgen::generate_simple_self_signed;
10+
extern crate rcgen;
11+
use rcgen::{generate_simple_self_signed, CertifiedKey};
12+
// Generate a certificate that's valid for "localhost" and "hello.world.example"
1113
let subject_alt_names = vec!["hello.world.example".to_string(),
1214
"localhost".to_string()];
1315

14-
let cert = generate_simple_self_signed(subject_alt_names).unwrap();
15-
// The certificate is now valid for localhost and the domain "hello.world.example"
16-
println!("{}", cert.serialize_pem().unwrap());
17-
println!("{}", cert.serialize_private_key_pem());
16+
let CertifiedKey { cert, key_pair } = generate_simple_self_signed(subject_alt_names).unwrap();
17+
println!("{}", cert.pem());
18+
println!("{}", key_pair.serialize_pem());
1819
```
1920

2021
## Trying it out with openssl

0 commit comments

Comments
 (0)