Remove deprecated X509 methods
This commit is contained in:
parent
f36f610d07
commit
1bc96a5b3d
|
|
@ -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)]
|
#[allow(non_snake_case)]
|
||||||
/// Generator of private key/certificate pairs
|
/// Generator of private key/certificate pairs
|
||||||
///
|
///
|
||||||
|
|
@ -121,14 +117,15 @@ pub use self::extension::ExtKeyUsageOption as ExtKeyUsage;
|
||||||
/// use std::path::Path;
|
/// use std::path::Path;
|
||||||
///
|
///
|
||||||
/// use openssl::crypto::hash::Type;
|
/// use openssl::crypto::hash::Type;
|
||||||
/// use openssl::x509::{KeyUsage, X509Generator};
|
/// use openssl::x509::X509Generator;
|
||||||
|
/// use openssl::x509::extension::{Extension, KeyUsageOption};
|
||||||
///
|
///
|
||||||
/// let gen = X509Generator::new()
|
/// let gen = X509Generator::new()
|
||||||
/// .set_bitlength(2048)
|
/// .set_bitlength(2048)
|
||||||
/// .set_valid_period(365*2)
|
/// .set_valid_period(365*2)
|
||||||
/// .set_CN("SuperMegaCorp Inc.")
|
/// .add_name("CN".to_owned(), "SuperMegaCorp Inc.".to_owned())
|
||||||
/// .set_sign_hash(Type::SHA256)
|
/// .set_sign_hash(Type::SHA256)
|
||||||
/// .set_usage(&[KeyUsage::DigitalSignature]);
|
/// .add_extension(Extension::KeyUsage(vec![KeyUsageOption::DigitalSignature]));
|
||||||
///
|
///
|
||||||
/// let (cert, pkey) = gen.generate().unwrap();
|
/// let (cert, pkey) = gen.generate().unwrap();
|
||||||
///
|
///
|
||||||
|
|
@ -184,22 +181,6 @@ impl X509Generator {
|
||||||
self
|
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
|
/// Add attribute to the name of the certificate
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
|
@ -223,20 +204,6 @@ impl X509Generator {
|
||||||
self
|
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
|
/// Add an extension to a certificate
|
||||||
///
|
///
|
||||||
/// If the extension already exists, it will be replaced.
|
/// If the extension already exists, it will be replaced.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue