Struct x509_certificate::certificate::X509CertificateBuilder [−][src]
pub struct X509CertificateBuilder { /* fields omitted */ }
Interface for constructing new X.509 certificates.
This holds fields for various certificate metadata and allows you to incrementally derive a new X.509 certificate.
The certificate is populated with defaults:
- The serial number is 1.
- The time validity is now until 1 hour from now.
- There is no issuer. If no attempt is made to define an issuer, the subject will be copied to the issuer field and this will be a self-signed certificate.
Implementations
impl X509CertificateBuilder
[src]
impl X509CertificateBuilder
[src]pub fn new(alg: KeyAlgorithm) -> Self
[src]
pub fn subject(&mut self) -> &mut Name
[src]
pub fn subject(&mut self) -> &mut Name
[src]Obtain a mutable reference to the subject Name.
The type has functions that will allow you to add attributes with ease.
pub fn issuer(&mut self) -> &mut Name
[src]
pub fn issuer(&mut self) -> &mut Name
[src]Obtain a mutable reference to the issuer Name.
If no issuer has been created yet, an empty one will be created.
pub fn serial_number(&mut self, value: i64)
[src]
pub fn serial_number(&mut self, value: i64)
[src]Set the serial number for the certificate.
pub fn extensions(&self) -> &Extensions
[src]
pub fn extensions(&self) -> &Extensions
[src]Obtain the raw certificate extensions.
pub fn extensions_mut(&mut self) -> &mut Extensions
[src]
pub fn extensions_mut(&mut self) -> &mut Extensions
[src]Obtain a mutable reference to raw certificate extensions.
pub fn add_extension_der_data(
&mut self,
oid: Oid,
critical: bool,
data: impl AsRef<[u8]>
)
[src]
pub fn add_extension_der_data(
&mut self,
oid: Oid,
critical: bool,
data: impl AsRef<[u8]>
)
[src]Add an extension to the certificate with its value as pre-encoded DER data.
pub fn validity_duration(&mut self, duration: Duration)
[src]
pub fn validity_duration(&mut self, duration: Duration)
[src]Set the expiration time in terms of Duration since its currently set start time.
pub fn constraint_not_ca(&mut self)
[src]
pub fn constraint_not_ca(&mut self)
[src]Add a basic constraint extension that this isn’t a CA certificate.
pub fn create_with_random_keypair(
&self
) -> Result<(CapturedX509Certificate, InMemorySigningKeyPair, Document), Error>
[src]
pub fn create_with_random_keypair(
&self
) -> Result<(CapturedX509Certificate, InMemorySigningKeyPair, Document), Error>
[src]Create a new certificate given settings, using a randomly generated key pair.