From 1bc96a5b3dce5de6a161a0f04cb38d3b81e8615e Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Mon, 16 Nov 2015 20:44:38 -0800 Subject: [PATCH] Remove deprecated X509 methods --- openssl/src/x509/mod.rs | 41 ++++------------------------------------- 1 file changed, 4 insertions(+), 37 deletions(-) diff --git a/openssl/src/x509/mod.rs b/openssl/src/x509/mod.rs index 8148749a5..5574077ab 100644 --- a/openssl/src/x509/mod.rs +++ b/openssl/src/x509/mod.rs @@ -103,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 /// @@ -121,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(); /// @@ -184,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 /// /// ``` @@ -223,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. -- GitLab