diff options
| author | Steven Fackler <[email protected]> | 2016-08-07 22:44:42 -0700 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2016-08-07 22:44:42 -0700 |
| commit | a8f827d28c21a9fc816ac4291a9dbfe943e23027 (patch) | |
| tree | 36740f3bb502bfb2d2b85d4895ec7370f7e9128e /openssl/src | |
| parent | Restore disabled tests (diff) | |
| download | rust-openssl-a8f827d28c21a9fc816ac4291a9dbfe943e23027.tar.xz rust-openssl-a8f827d28c21a9fc816ac4291a9dbfe943e23027.zip | |
Fix example
Diffstat (limited to 'openssl/src')
| -rw-r--r-- | openssl/src/x509/mod.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/openssl/src/x509/mod.rs b/openssl/src/x509/mod.rs index 347c9736..407c5fbc 100644 --- a/openssl/src/x509/mod.rs +++ b/openssl/src/x509/mod.rs @@ -106,16 +106,21 @@ impl X509StoreContext { } #[allow(non_snake_case)] -// FIXME /// Generator of private key/certificate pairs /// /// # Example /// -/// ```ignore +/// ``` /// use openssl::crypto::hash::Type; +/// use openssl::crypto::pkey::PKey; +/// use openssl::crypto::rsa::RSA; /// use openssl::x509::X509Generator; /// use openssl::x509::extension::{Extension, KeyUsageOption}; /// +/// let rsa = RSA::generate(2048).unwrap(); +/// let mut pkey = PKey::new().unwrap(); +/// pkey.set_rsa(&rsa).unwrap(); +/// /// let gen = X509Generator::new() /// .set_bitlength(2048) /// .set_valid_period(365*2) @@ -123,8 +128,8 @@ impl X509StoreContext { /// .set_sign_hash(Type::SHA256) /// .add_extension(Extension::KeyUsage(vec![KeyUsageOption::DigitalSignature])); /// -/// let (cert, pkey) = gen.generate().unwrap(); -/// let cert_pem = cert.write_pem().unwrap(); +/// let cert = gen.sign(&pkey).unwrap(); +/// let cert_pem = cert.to_pem().unwrap(); /// let pkey_pem = pkey.private_key_to_pem().unwrap(); /// ``` pub struct X509Generator { |