Skip to main content

SigningKey

Trait SigningKey 

Source
pub trait SigningKey {
    type Hasher: HashImpl;

    // Required methods
    fn sign(&self, input: impl Writable) -> Result<Vec<u8>>;
    fn algorithm(&self) -> Algorithm;

    // Provided methods
    fn hash(&self, data: impl Writable) -> HashOutput { ... }
    fn heap_size(&self) -> usize { ... }
}
Expand description

A private key that can produce DKIM, ARC and DKIM2 signatures.

Implemented by RsaKey<Sha256>, Ed25519Key, MlDsa44Key and DkimKey. Signers such as DkimSigner are generic over this trait.

Required Associated Types§

Source

type Hasher: HashImpl

The hash function used by the signature algorithm.

Required Methods§

Source

fn sign(&self, input: impl Writable) -> Result<Vec<u8>>

Signs the bytes written by input and returns the raw signature.

§Errors

Returns Error::Crypto with CryptoError::Library if the backend fails to sign.

Source

fn algorithm(&self) -> Algorithm

Returns the signature algorithm written to the a= tag.

Provided Methods§

Source

fn hash(&self, data: impl Writable) -> HashOutput

Hashes the bytes written by data with Self::Hasher.

Source

fn heap_size(&self) -> usize

Approximate heap memory owned by the key, in bytes, for weighing cache entries that hold it.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl SigningKey for DkimKey

Available on crate features aws-lc-rs or rust-crypto only.
Source§

impl SigningKey for Ed25519Key

Source§

impl SigningKey for MlDsa44Key

Source§

impl SigningKey for RsaKey<Sha256>