diff options
| author | Steven Fackler <[email protected]> | 2015-11-16 21:11:00 -0800 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2015-11-16 21:11:00 -0800 |
| commit | 094e8e5b3e6eef13b03fd8c5b67b4aaf81af5d5c (patch) | |
| tree | 21e7a32e45992656ddefbf95c3179eb0f914b865 /openssl/src/x509/mod.rs | |
| parent | Merge branch 'release-v0.6.7' into release (diff) | |
| parent | Release v0.7.0 (diff) | |
| download | rust-openssl-0.7.0.tar.xz rust-openssl-0.7.0.zip | |
Merge branch 'release-v0.7.0' into releasev0.7.0
Diffstat (limited to 'openssl/src/x509/mod.rs')
| -rw-r--r-- | openssl/src/x509/mod.rs | 44 |
1 files changed, 6 insertions, 38 deletions
diff --git a/openssl/src/x509/mod.rs b/openssl/src/x509/mod.rs index 91daa66a..5574077a 100644 --- a/openssl/src/x509/mod.rs +++ b/openssl/src/x509/mod.rs @@ -18,6 +18,7 @@ use crypto::hash::Type as HashType; use crypto::pkey::{PKey,Parts}; use crypto::rand::rand_bytes; use ffi; +use ffi_extras; use ssl::error::{SslError, StreamError}; use nid; @@ -102,10 +103,6 @@ impl X509StoreContext { } } -// Backwards-compatibility -pub use self::extension::KeyUsageOption as KeyUsage; -pub use self::extension::ExtKeyUsageOption as ExtKeyUsage; - #[allow(non_snake_case)] /// Generator of private key/certificate pairs /// @@ -120,14 +117,15 @@ pub use self::extension::ExtKeyUsageOption as ExtKeyUsage; /// use std::path::Path; /// /// use openssl::crypto::hash::Type; -/// use openssl::x509::{KeyUsage, X509Generator}; +/// use openssl::x509::X509Generator; +/// use openssl::x509::extension::{Extension, KeyUsageOption}; /// /// let gen = X509Generator::new() /// .set_bitlength(2048) /// .set_valid_period(365*2) -/// .set_CN("SuperMegaCorp Inc.") +/// .add_name("CN".to_owned(), "SuperMegaCorp Inc.".to_owned()) /// .set_sign_hash(Type::SHA256) -/// .set_usage(&[KeyUsage::DigitalSignature]); +/// .add_extension(Extension::KeyUsage(vec![KeyUsageOption::DigitalSignature])); /// /// let (cert, pkey) = gen.generate().unwrap(); /// @@ -183,22 +181,6 @@ impl X509Generator { self } - #[allow(non_snake_case)] - /// (deprecated) Sets Common Name of certificate - /// - /// This function is deprecated, use `X509Generator.add_name` instead. - /// Don't use this function AND the `add_name` method - pub fn set_CN(mut self, CN: &str) -> X509Generator { - match self.names.get_mut(0) { - Some(&mut(_,ref mut val)) => *val=CN.to_string(), - _ => {} /* would move push here, but borrow checker won't let me */ - } - if self.names.len()==0 { - self.names.push(("CN".to_string(),CN.to_string())); - } - self - } - /// Add attribute to the name of the certificate /// /// ``` @@ -222,20 +204,6 @@ impl X509Generator { self } - /// (deprecated) Sets what for certificate could be used - /// - /// This function is deprecated, use `X509Generator.add_extension` instead. - pub fn set_usage(self, purposes: &[KeyUsage]) -> X509Generator { - self.add_extension(Extension::KeyUsage(purposes.to_owned())) - } - - /// (deprecated) Sets allowed extended usage of certificate - /// - /// This function is deprecated, use `X509Generator.add_extension` instead. - pub fn set_ext_usage(self, purposes: &[ExtKeyUsage]) -> X509Generator { - self.add_extension(Extension::ExtKeyUsage(purposes.to_owned())) - } - /// Add an extension to a certificate /// /// If the extension already exists, it will be replaced. @@ -400,7 +368,7 @@ impl X509Generator { let req = ffi::X509_to_X509_REQ(cert.handle, ptr::null_mut(), ptr::null()); try_ssl_null!(req); - let exts = ffi::X509_get_extensions(cert.handle); + let exts = ffi_extras::X509_get_extensions(cert.handle); if exts != ptr::null_mut() { try_ssl!(ffi::X509_REQ_add_extensions(req,exts)); } |