Struct openssl::x509::X509Generator
[−]
[src]
pub struct X509Generator { /* fields omitted */ }
: use X509Builder and X509ReqBuilder instead
Methods
impl X509Generator
[src]
pub fn new() -> X509Generator
[src]
: use X509Builder and X509ReqBuilder instead
Creates a new generator with the following defaults:
validity period: 365 days
CN: "rust-openssl"
hash: SHA1
pub fn set_valid_period(self, days: u32) -> X509Generator
[src]
: use X509Builder and X509ReqBuilder instead
Sets certificate validity period in days since today
pub fn add_name(self, attr_type: String, attr_value: String) -> X509Generator
[src]
: use X509Builder and X509ReqBuilder instead
Add attribute to the name of the certificate
generator.add_name("CN".to_string(),"example.com".to_string());
pub fn add_names<I>(self, attrs: I) -> X509Generator where
I: IntoIterator<Item = (String, String)>,
[src]
I: IntoIterator<Item = (String, String)>,
: use X509Builder and X509ReqBuilder instead
Add multiple attributes to the name of the certificate
generator.add_names(vec![("CN".to_string(),"example.com".to_string())]);
pub fn add_extension(self, ext: Extension) -> X509Generator
[src]
: use X509Builder and X509ReqBuilder instead
Add an extension to a certificate
If the extension already exists, it will be replaced.
use openssl::x509::extension::Extension::*; use openssl::x509::extension::KeyUsageOption::*; generator.add_extension(KeyUsage(vec![DigitalSignature, KeyEncipherment]));
pub fn add_extensions<I>(self, exts: I) -> X509Generator where
I: IntoIterator<Item = Extension>,
[src]
I: IntoIterator<Item = Extension>,
: use X509Builder and X509ReqBuilder instead
Add multiple extensions to a certificate
If any of the extensions already exist, they will be replaced.
use openssl::x509::extension::Extension::*; use openssl::x509::extension::KeyUsageOption::*; generator.add_extensions(vec![KeyUsage(vec![DigitalSignature, KeyEncipherment])]);
pub fn set_sign_hash(self, hash_type: MessageDigest) -> X509Generator
[src]
: use X509Builder and X509ReqBuilder instead
pub fn sign(&self, p_key: &PKeyRef) -> Result<X509, ErrorStack>
[src]
: use X509Builder and X509ReqBuilder instead
Sets the certificate public-key, then self-sign and return it
pub fn request(&self, p_key: &PKeyRef) -> Result<X509Req, ErrorStack>
[src]
: use X509Builder and X509ReqBuilder instead
Obtain a certificate signing request (CSR)