Struct CertificateBuilder

Source
pub struct CertificateBuilder<'a> { /* private fields */ }
Expand description

Certificate builder is used to create X.509 certificate chains

Implementations§

Source§

impl<'a> CertificateBuilder<'a>

Source

pub fn new() -> Self

Create a new certificate builder with default parameters

Source

pub fn signer<S>(&mut self, signer: S) -> &mut Self
where S: Into<Option<&'a KeyStore>>,

Specify certificate signer. If omitted or None a self-signed certificate is created.

Source

pub fn usage(&mut self, usage: CertUsage) -> &mut Self

Specify certificate usage

Source

pub fn alt_names<S, I>(&mut self, alt_names: I) -> &mut Self
where I: IntoIterator<Item = S>, S: AsRef<str>,

Specify DNS or IP names for the subjectAltName extension. This is a required setting for the TLS SNI matching.

Source

pub fn not_before(&mut self, time: SystemTime) -> &mut Self

Specify start date of the certificate

Source

pub fn not_after(&mut self, time: SystemTime) -> &mut Self

Specify expiration date of the certificate

Source

pub fn private_key(&mut self, key: PrivateKey) -> &mut Self

Specify a custom private key for the certificate chain. If not specified a default RSA-2048 key will be generated.

Source

pub fn subject(&mut self, name: CertName) -> &mut Self

Specify certificate subject

Source

pub fn serial_number(&mut self, number: u64) -> &mut Self

Specify serial number for the certificate, default is current Unix timestamp.

Source

pub fn path_len(&mut self, path_len: i32) -> &mut Self

Specify pathlen parameter for CA certificate, default is i32::MAX

Source

pub fn build(&self) -> Result<KeyStore>

Create X.509 certificate chain

Trait Implementations§

Source§

impl<'a> Default for CertificateBuilder<'a>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for CertificateBuilder<'a>

§

impl<'a> RefUnwindSafe for CertificateBuilder<'a>

§

impl<'a> Send for CertificateBuilder<'a>

§

impl<'a> Sync for CertificateBuilder<'a>

§

impl<'a> Unpin for CertificateBuilder<'a>

§

impl<'a> UnwindSafe for CertificateBuilder<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.