pub struct X509CertificateBuilder { /* private fields */ }
Expand description

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.

This type can also be used to produce certificate signing requests. In this mode, only the subject value and additional registered attributes are meaningful.

Implementations

Obtain a mutable reference to the subject Name.

The type has functions that will allow you to add attributes with ease.

Obtain a mutable reference to the issuer Name.

If no issuer has been created yet, an empty one will be created.

Set the serial number for the certificate.

Obtain the raw certificate extensions.

Obtain a mutable reference to raw certificate extensions.

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

Set the expiration time in terms of Duration since its currently set start time.

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

Add a key usage extension.

Add an [Attribute] to a future certificate signing requests.

Has no effect on regular certificate creation: only if creating certificate signing requests.

Create a new certificate given settings, using a randomly generated key pair.

Create a new certificate signing request (CSR).

The CSR is derived according to the process defined in RFC 2986 Section 3. Essentially, we collect metadata about the request, sign that metadata using a provided signing/private key, then attach the signature to form a complete certification request.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.