Skip to main content

Algorithm

Trait Algorithm 

Source
pub trait Algorithm {
    type Curve: Curve;

    // Required method
    fn maybe_prehash(msg: impl AsRef<[u8]>) -> impl AsRef<[u8]>;

    // Provided method
    fn verify(
        public_key: &<Self::Curve as Curve>::PublicKey,
        msg: impl AsRef<[u8]>,
        signature: &<Self::Curve as Curve>::Signature,
    ) -> bool { ... }
}
Expand description

Required Associated Types§

Source

type Curve: Curve

Required Methods§

Source

fn maybe_prehash(msg: impl AsRef<[u8]>) -> impl AsRef<[u8]>

Optionally, prehash the message (or perform any other manipulations) before passing it to Self::Curve::verify() in the last signature verification step:

  1. Using credentialRecord.publicKey, verify that sig is a valid signature over the binary concatenation of authData and hash.

Provided Methods§

Source

fn verify( public_key: &<Self::Curve as Curve>::PublicKey, msg: impl AsRef<[u8]>, signature: &<Self::Curve as Curve>::Signature, ) -> bool

Last algorithm-specific signature verification step:

  1. Using credentialRecord.publicKey, verify that sig is a valid signature over the binary concatenation of authData and hash.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§