pub struct CertificateRequestBuilder { /* private fields */ }Expand description
Builder for X509 Certificate Requests (CSR)
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).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>(&signer).unwrap();Implementations§
Source§impl RequestBuilder
impl RequestBuilder
Sourcepub fn new(subject: Name) -> Result<RequestBuilder, Error>
pub fn new(subject: Name) -> Result<RequestBuilder, Error>
Creates a new certificate request builder
Sourcepub fn add_extension<E>(
&mut self,
extension: E,
) -> Result<(), <E as ToExtension>::Error>where
E: ToExtension,
pub fn add_extension<E>(
&mut self,
extension: E,
) -> Result<(), <E as ToExtension>::Error>where
E: ToExtension,
Add an extension to this certificate request
Extensions need to implement ToExtension, examples may be found in
in ToExtension documentation or
the implementors.
Sourcepub fn add_attribute<A>(&mut self, attribute: &A) -> Result<(), Error>where
A: AsAttribute,
pub fn add_attribute<A>(&mut self, attribute: &A) -> Result<(), Error>where
A: AsAttribute,
Add an attribute to this certificate request
Trait Implementations§
Source§impl Builder for RequestBuilder
impl Builder for RequestBuilder
Source§fn finalize<S>(&mut self, signer: &S) -> Result<Vec<u8>, Error>
fn finalize<S>(&mut self, signer: &S) -> Result<Vec<u8>, Error>
Finalize and return a serialization of the object for signature.
Source§fn assemble<S>(
self,
signature: BitString,
signer: &S,
) -> Result<<RequestBuilder as Builder>::Output, Error>
fn assemble<S>( self, signature: BitString, signer: &S, ) -> Result<<RequestBuilder as Builder>::Output, Error>
Assemble the final object from signature.
Source§fn build<S, Signature>(self, signer: &S) -> Result<Self::Output, Error>where
S: Signer<Signature> + Keypair + DynSignatureAlgorithmIdentifier,
<S as Keypair>::VerifyingKey: EncodePublicKey,
Signature: SignatureBitStringEncoding,
fn build<S, Signature>(self, signer: &S) -> Result<Self::Output, Error>where
S: Signer<Signature> + Keypair + DynSignatureAlgorithmIdentifier,
<S as Keypair>::VerifyingKey: EncodePublicKey,
Signature: SignatureBitStringEncoding,
Run the object through the signer and build it. Read more
Source§fn build_with_rng<S, Signature, R>(
self,
signer: &S,
rng: &mut R,
) -> Result<Self::Output, Error>where
S: RandomizedSigner<Signature> + Keypair + DynSignatureAlgorithmIdentifier,
<S as Keypair>::VerifyingKey: EncodePublicKey,
Signature: SignatureBitStringEncoding,
R: CryptoRng + ?Sized,
fn build_with_rng<S, Signature, R>(
self,
signer: &S,
rng: &mut R,
) -> Result<Self::Output, Error>where
S: RandomizedSigner<Signature> + Keypair + DynSignatureAlgorithmIdentifier,
<S as Keypair>::VerifyingKey: EncodePublicKey,
Signature: SignatureBitStringEncoding,
R: CryptoRng + ?Sized,
Run the object through the signer and build it. Read more
Auto Trait Implementations§
impl Freeze for RequestBuilder
impl RefUnwindSafe for RequestBuilder
impl Send for RequestBuilder
impl Sync for RequestBuilder
impl Unpin for RequestBuilder
impl UnsafeUnpin for RequestBuilder
impl UnwindSafe for RequestBuilder
Blanket Implementations§
Source§impl<T> AsyncBuilder for Twhere
T: Builder,
impl<T> AsyncBuilder for Twhere
T: Builder,
Source§fn assemble<S>(
self,
signature: BitString,
signer: &S,
) -> Result<<T as AsyncBuilder>::Output, Error>
fn assemble<S>( self, signature: BitString, signer: &S, ) -> Result<<T as AsyncBuilder>::Output, Error>
Assemble the final object from signature.
Source§fn finalize<S>(&mut self, signer: &S) -> Result<Vec<u8>, Error>
fn finalize<S>(&mut self, signer: &S) -> Result<Vec<u8>, Error>
Finalize and return a serialization of the object for signature.
Source§async fn build_async<S, Signature>(
self,
signer: &S,
) -> Result<Self::Output, Error>where
S: AsyncSigner<Signature> + Keypair + DynSignatureAlgorithmIdentifier,
<S as Keypair>::VerifyingKey: EncodePublicKey,
Signature: SignatureBitStringEncoding,
async fn build_async<S, Signature>(
self,
signer: &S,
) -> Result<Self::Output, Error>where
S: AsyncSigner<Signature> + Keypair + DynSignatureAlgorithmIdentifier,
<S as Keypair>::VerifyingKey: EncodePublicKey,
Signature: SignatureBitStringEncoding,
Run the object through the signer and build it. Read more
Source§async fn build_with_rng_async<S, Signature, R>(
self,
signer: &S,
rng: &mut R,
) -> Result<Self::Output, Error>where
S: AsyncRandomizedSigner<Signature> + Keypair + DynSignatureAlgorithmIdentifier,
<S as Keypair>::VerifyingKey: EncodePublicKey,
Signature: SignatureBitStringEncoding,
R: CryptoRng + ?Sized,
async fn build_with_rng_async<S, Signature, R>(
self,
signer: &S,
rng: &mut R,
) -> Result<Self::Output, Error>where
S: AsyncRandomizedSigner<Signature> + Keypair + DynSignatureAlgorithmIdentifier,
<S as Keypair>::VerifyingKey: EncodePublicKey,
Signature: SignatureBitStringEncoding,
R: CryptoRng + ?Sized,
Run the object through the signer and build it. Read more
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