Skip to main content
This is unreleased documentation for the main (development) branch of crypto-glue.

AsyncBuilder

Trait AsyncBuilder 

Source
pub trait AsyncBuilder: Sized {
    type Output: Sized;

    // Required methods
    fn assemble<S>(
        self,
        signature: BitString,
        signer: &S,
    ) -> Result<Self::Output>
       where S: Keypair + DynSignatureAlgorithmIdentifier,
             S::VerifyingKey: EncodePublicKey;
    fn finalize<S>(&mut self, signer: &S) -> Result<Vec<u8>>
       where S: Keypair + DynSignatureAlgorithmIdentifier,
             S::VerifyingKey: EncodePublicKey;

    // Provided methods
    async fn build_async<S, Signature>(self, signer: &S) -> Result<Self::Output>
       where S: AsyncSigner<Signature> + Keypair + DynSignatureAlgorithmIdentifier,
             S::VerifyingKey: EncodePublicKey,
             Signature: SignatureBitStringEncoding { ... }
    async fn build_with_rng_async<S, Signature, R>(
        self,
        signer: &S,
        rng: &mut R,
    ) -> Result<Self::Output>
       where S: AsyncRandomizedSigner<Signature> + Keypair + DynSignatureAlgorithmIdentifier,
             S::VerifyingKey: EncodePublicKey,
             Signature: SignatureBitStringEncoding,
             R: CryptoRng + ?Sized { ... }
}
Expand description

Trait for async X509 builders

This trait defines the interface between builder and the signers.

This is the async counterpart of Builder.

Required Associated Types§

Source

type Output: Sized

Type built by this builder

Required Methods§

Source

fn assemble<S>(self, signature: BitString, signer: &S) -> Result<Self::Output>

Assemble the final object from signature.

Source

fn finalize<S>(&mut self, signer: &S) -> Result<Vec<u8>>

Finalize and return a serialization of the object for signature.

Provided Methods§

Source

async fn build_async<S, Signature>(self, signer: &S) -> Result<Self::Output>

Run the object through the signer and build it.

§Notes

When using ECDSA signers, the Signature parameter will need to be explicit as multiple implementation of signature::AsyncSigner with various signature are available.

This would look like:

let certificate = builder.build_async::<_, ecdsa::der::Signature<_>>(&signer).await?;
Source

async fn build_with_rng_async<S, Signature, R>( self, signer: &S, rng: &mut R, ) -> Result<Self::Output>

Run the object through the signer and build it.

§Notes

When using ECDSA signers, the Signature parameter will need to be explicit as multiple implementation of signature::AsyncSigner with various signature are available.

This would look like:

let certificate = builder.build_with_rng_async::<_, ecdsa::der::Signature<_>, _>(&signer, &mut rng).await?;

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T> AsyncBuilder for T
where T: Builder,