Skip to main content

CryptoProvider

Trait CryptoProvider 

Source
pub trait CryptoProvider:
    Debug
    + Send
    + Sync {
    // Required methods
    fn digest(
        &self,
        algorithm: DigestAlgorithm,
    ) -> Result<Box<dyn DigestContext>>;
    fn hmac(
        &self,
        algorithm: DigestAlgorithm,
        secret: &[u8],
    ) -> Result<Box<dyn HmacContext>>;
    fn sign(
        &self,
        algorithm: SigningAlgorithm,
        pem: &[u8],
    ) -> Result<Box<dyn Signer>>;
}
Expand description

Provides cryptographic primitives

Required Methods§

Source

fn digest(&self, algorithm: DigestAlgorithm) -> Result<Box<dyn DigestContext>>

Compute a digest

Source

fn hmac( &self, algorithm: DigestAlgorithm, secret: &[u8], ) -> Result<Box<dyn HmacContext>>

Compute an HMAC with the provided secret

Source

fn sign( &self, algorithm: SigningAlgorithm, pem: &[u8], ) -> Result<Box<dyn Signer>>

Sign a payload with the provided PEM-encoded secret

Implementors§