Trait AsyncRawSigner

Source
pub trait AsyncRawSigner: AsyncTimeStampProvider + Sync {
    // Required methods
    fn sign<'life0, 'async_trait>(
        &'life0 self,
        data: Vec<u8>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, RawSignerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn alg(&self) -> SigningAlg;
    fn cert_chain(&self) -> Result<Vec<Vec<u8>>, RawSignerError>;
    fn reserve_size(&self) -> usize;

    // Provided method
    fn ocsp_response<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Option<Vec<u8>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Implementations of the AsyncRawSigner trait generate a cryptographic signature over an arbitrary byte array.

Use this trait only when the implementation must be asynchronous.

Required Methods§

Source

fn sign<'life0, 'async_trait>( &'life0 self, data: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, RawSignerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return a raw signature over the original byte slice.

Source

fn alg(&self) -> SigningAlg

Return the algorithm implemented by this signer.

Source

fn cert_chain(&self) -> Result<Vec<Vec<u8>>, RawSignerError>

Return the signing certificate chain.

Each certificate should be encoded in DER format and sequenced from end-entity certificate to the outermost certificate authority.

Source

fn reserve_size(&self) -> usize

Return the size in bytes of the largest possible expected signature. Signing will fail if the result of the sign function is larger than this value.

Provided Methods§

Source

fn ocsp_response<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Option<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return an OCSP response for the signing certificate if available.

By pre-querying the value for the signing certificate, the value can be cached which will reduce load on the certificate authority, as recommended by the C2PA spec.

Implementors§