Skip to main content

VerifyingKey

Trait VerifyingKey 

Source
pub trait VerifyingKey {
    // Required methods
    fn verify<'a>(
        &self,
        headers: &mut dyn Iterator<Item = (&'a [u8], &'a [u8])>,
        signature: &[u8],
        canonicalization: Canonicalization,
        algorithm: Algorithm,
    ) -> Result<()>;
    fn verify_bytes(
        &self,
        input: &[u8],
        signature: &[u8],
        algorithm: Algorithm,
    ) -> Result<()>;

    // Provided methods
    fn public_key_bits(&self) -> usize { ... }
    fn heap_size(&self) -> usize { ... }
}
Expand description

A public key that can verify signatures, parsed from the p= tag of a DKIM key record (RFC 6376 Section 3.6.1).

Required Methods§

Source

fn verify<'a>( &self, headers: &mut dyn Iterator<Item = (&'a [u8], &'a [u8])>, signature: &[u8], canonicalization: Canonicalization, algorithm: Algorithm, ) -> Result<()>

Canonicalizes headers with canonicalization and verifies signature over the result, using algorithm.

§Errors

Returns Error::Crypto with CryptoError::IncompatibleAlgorithms if algorithm does not match the key type, or with CryptoError::FailedVerification or CryptoError::Library if the signature does not verify.

Source

fn verify_bytes( &self, input: &[u8], signature: &[u8], algorithm: Algorithm, ) -> Result<()>

Verifies signature over input, an already canonicalized byte string, using algorithm.

§Errors

Returns Error::Crypto with CryptoError::IncompatibleAlgorithms if algorithm does not match the key type, or with CryptoError::FailedVerification if the signature does not verify.

Provided Methods§

Source

fn public_key_bits(&self) -> usize

Size in bits of the public key (the RSA modulus length). The default implementation returns usize::MAX, which Ed25519 and composite keys keep, so that minimum key size checks apply to RSA keys only.

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 dyn compatible.

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

Implementors§