fn_dsa

Trait VerifyingKey

Source
pub trait VerifyingKey: Sized {
    // Required methods
    fn decode(src: &[u8]) -> Option<Self>;
    fn verify(
        &self,
        sig: &[u8],
        ctx: &DomainContext<'_>,
        id: &HashIdentifier<'_>,
        hv: &[u8],
    ) -> bool;
}
Expand description

Verifying key handler.

Required Methods§

Source

fn decode(src: &[u8]) -> Option<Self>

Create the instance by decoding the verifying key from its storage format.

If the source uses a degree not supported by this VerifyingKey type, or does not have the exact length expected for the degree it uses, or is otherwise invalidly encoded, then this function returns None; otherwise, it returns the new instance.

Source

fn verify( &self, sig: &[u8], ctx: &DomainContext<'_>, id: &HashIdentifier<'_>, hv: &[u8], ) -> bool

Verify a signature.

Parameters:

  • sig: the signature value
  • ctx: the domain separation context
  • id: the identifier for the pre-hash function
  • hv: the pre-hashed message (or the message itself, if id is HASH_ID_RAW)

Return value is true if the signature is valid, false otherwise. Signature decoding errors and degree mismatch with the verifying key also lead to false being returned.

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§