Trait RawSigner

Source
pub trait RawSigner: TimeStampProvider {
    // Required methods
    fn sign(&self, data: &[u8]) -> Result<Vec<u8>, RawSignerError>;
    fn alg(&self) -> SigningAlg;
    fn cert_chain(&self) -> Result<Vec<Vec<u8>>, RawSignerError>;
    fn reserve_size(&self) -> usize;

    // Provided method
    fn ocsp_response(&self) -> Option<Vec<u8>> { ... }
}
Expand description

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

If an implementation can be asynchronous, that is preferred.

Required Methods§

Source

fn sign(&self, data: &[u8]) -> Result<Vec<u8>, RawSignerError>

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(&self) -> Option<Vec<u8>>

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§