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]

pub fn new(alg: KeyAlgorithm) -> Self[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]

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]

Set the serial number for the certificate.

pub fn extensions(&self) -> &Extensions[src]

Obtain the raw certificate extensions.

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]

Add an extension to the certificate with its value as pre-encoded DER data.

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]

Add a basic constraint extension that this isn’t a CA certificate.

pub fn key_usage(&mut self, key_usage: KeyUsage)[src]

Add a key usage extension.

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.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.