Struct x509_cert::builder::RequestBuilder
source · pub struct RequestBuilder<'s, S> { /* private fields */ }
Available on crate feature
builder
only.Expand description
Builder for X509 Certificate Requests
use x509_cert::{
builder::{Builder, RequestBuilder},
ext::pkix::{name::GeneralName, SubjectAltName},
name::Name,
};
use std::str::FromStr;
use std::net::{IpAddr, Ipv4Addr};
let subject = Name::from_str("CN=service.domination.world").unwrap();
let signer = ecdsa_signer();
let mut builder = RequestBuilder::new(subject, &signer).expect("Create certificate request");
builder
.add_extension(&SubjectAltName(vec![GeneralName::from(IpAddr::V4(
Ipv4Addr::new(192, 0, 2, 0),
))]))
.unwrap();
let cert_req = builder.build::<DerSignature>().unwrap();
Implementations§
source§impl<'s, S> RequestBuilder<'s, S>
impl<'s, S> RequestBuilder<'s, S>
sourcepub fn new(subject: Name, req_signer: &'s S) -> Result<Self, Error>
pub fn new(subject: Name, req_signer: &'s S) -> Result<Self, Error>
Creates a new certificate request builder
sourcepub fn add_extension<E: AsExtension>(
&mut self,
extension: &E
) -> Result<(), Error>
pub fn add_extension<E: AsExtension>( &mut self, extension: &E ) -> Result<(), Error>
Add an extension to this certificate request
sourcepub fn add_attribute<A: AsAttribute>(
&mut self,
attribute: &A
) -> Result<(), Error>
pub fn add_attribute<A: AsAttribute>( &mut self, attribute: &A ) -> Result<(), Error>
Add an attribute to this certificate request
Trait Implementations§
source§impl<'s, S> Builder for RequestBuilder<'s, S>
impl<'s, S> Builder for RequestBuilder<'s, S>
source§fn finalize(&mut self) -> Result<Vec<u8>>
fn finalize(&mut self) -> Result<Vec<u8>>
Finalize and return a serialization of the object for signature.
source§fn assemble(self, signature: BitString) -> Result<Self::Output, Error>
fn assemble(self, signature: BitString) -> Result<Self::Output, Error>
Assemble the final object from signature.
source§fn build<Signature>(self) -> Result<Self::Output, Error>
fn build<Signature>(self) -> Result<Self::Output, Error>
Run the object through the signer and build it.
source§fn build_with_rng<Signature>(
self,
rng: &mut impl CryptoRngCore
) -> Result<Self::Output, Error>
fn build_with_rng<Signature>( self, rng: &mut impl CryptoRngCore ) -> Result<Self::Output, Error>
Run the object through the signer and build it.
Auto Trait Implementations§
impl<'s, S> RefUnwindSafe for RequestBuilder<'s, S>where
S: RefUnwindSafe,
impl<'s, S> Send for RequestBuilder<'s, S>where
S: Sync,
impl<'s, S> Sync for RequestBuilder<'s, S>where
S: Sync,
impl<'s, S> Unpin for RequestBuilder<'s, S>
impl<'s, S> UnwindSafe for RequestBuilder<'s, S>where
S: RefUnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more