Remove X509Generator::bitlenth

This commit is contained in:
Steven Fackler 2016-08-07 22:46:14 -07:00
parent a8f827d28c
commit 6e5cd7ef47
2 changed files with 1 additions and 13 deletions

View File

@ -122,7 +122,6 @@ impl X509StoreContext {
/// pkey.set_rsa(&rsa).unwrap();
///
/// let gen = X509Generator::new()
/// .set_bitlength(2048)
/// .set_valid_period(365*2)
/// .add_name("CN".to_owned(), "SuperMegaCorp Inc.".to_owned())
/// .set_sign_hash(Type::SHA256)
@ -133,7 +132,6 @@ impl X509StoreContext {
/// let pkey_pem = pkey.private_key_to_pem().unwrap();
/// ```
pub struct X509Generator {
bits: u32,
days: u32,
names: Vec<(String, String)>,
extensions: Extensions,
@ -143,8 +141,6 @@ pub struct X509Generator {
impl X509Generator {
/// Creates a new generator with the following defaults:
///
/// bit length: 1024
///
/// validity period: 365 days
///
/// CN: "rust-openssl"
@ -152,7 +148,6 @@ impl X509Generator {
/// hash: SHA1
pub fn new() -> X509Generator {
X509Generator {
bits: 1024,
days: 365,
names: vec![],
extensions: Extensions::new(),
@ -160,12 +155,6 @@ impl X509Generator {
}
}
/// Sets desired bit length
pub fn set_bitlength(mut self, bits: u32) -> X509Generator {
self.bits = bits;
self
}
/// Sets certificate validity period in days since today
pub fn set_valid_period(mut self, days: u32) -> X509Generator {
self.days = days;

View File

@ -12,7 +12,6 @@ use nid::Nid;
fn get_generator() -> X509Generator {
X509Generator::new()
.set_bitlength(2048)
.set_valid_period(365 * 2)
.add_name("CN".to_string(), "test_me".to_string())
.set_sign_hash(SHA1)
@ -26,7 +25,7 @@ fn get_generator() -> X509Generator {
}
fn pkey() -> PKey {
let rsa = RSA::generate(512).unwrap();
let rsa = RSA::generate(2048).unwrap();
let mut pkey = PKey::new().unwrap();
pkey.set_rsa(&rsa).unwrap();
pkey