pub struct X509Builder(X509);
Expand description

A builder used to construct an X509.

Tuple Fields

0: X509

Implementations

Creates a new builder.

Sets the notAfter constraint on the certificate.

Sets the notBefore constraint on the certificate.

Sets the version of the certificate.

Note that the version is zero-indexed; that is, a certificate corresponding to version 3 of the X.509 standard should pass 2 to this method.

Sets the serial number of the certificate.

Sets the issuer name of the certificate.

Sets the subject name of the certificate.

When building certificates, the C, ST, and O options are common when using the openssl command line tools. The CN field is used for the common name, such as a DNS name.

use openssl::x509::{X509, X509NameBuilder};

let mut x509_name = openssl::x509::X509NameBuilder::new().unwrap();
x509_name.append_entry_by_text("C", "US").unwrap();
x509_name.append_entry_by_text("ST", "CA").unwrap();
x509_name.append_entry_by_text("O", "Some organization").unwrap();
x509_name.append_entry_by_text("CN", "www.example.com").unwrap();
let x509_name = x509_name.build();

let mut x509 = openssl::x509::X509::builder().unwrap();
x509.set_subject_name(&x509_name).unwrap();

Sets the public key associated with the certificate.

Returns a context object which is needed to create certain X509 extension values.

Set issuer to None if the certificate will be self-signed.

Adds an X509 extension value to the certificate.

This works just as append_extension except it takes ownership of the X509Extension.

Adds an X509 extension value to the certificate.

This corresponds to X509_add_ext.

Signs the certificate with a private key.

Consumes the builder, returning the certificate.

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.