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§
Sourcefn verify<'a>(
&self,
headers: &mut dyn Iterator<Item = (&'a [u8], &'a [u8])>,
signature: &[u8],
canonicalization: Canonicalization,
algorithm: Algorithm,
) -> Result<()>
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.
Sourcefn verify_bytes(
&self,
input: &[u8],
signature: &[u8],
algorithm: Algorithm,
) -> Result<()>
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§
Sourcefn public_key_bits(&self) -> usize
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 ML-DSA-44 keys
keep, so that minimum key size checks apply to RSA keys only.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".