Trait mundane::public::Signature

source ·
pub trait Signature: Sealed + Sized {
    type PrivateKey: PrivateKey;

    // Required methods
    fn sign(key: &Self::PrivateKey, message: &[u8]) -> Result<Self, Error>;
    fn is_valid(
        &self,
        key: &<Self::PrivateKey as PrivateKey>::Public,
        message: &[u8],
    ) -> bool;
}
Expand description

A cryptographic signature generated by a private key.

Required Associated Types§

source

type PrivateKey: PrivateKey

The private key type used to generate this signature.

Required Methods§

source

fn sign(key: &Self::PrivateKey, message: &[u8]) -> Result<Self, Error>

Sign a message.

The input to this function is always a message, never a digest. If a signature scheme calls for hashing a message and signing the hash digest, sign is responsible for both hashing and signing.

source

fn is_valid( &self, key: &<Self::PrivateKey as PrivateKey>::Public, message: &[u8], ) -> bool

Verify a signature.

The input to this function is always a message, never a digest. If a signature scheme calls for hashing a message and signing the hash digest, is_valid is responsible for both hashing and verifying the digest.

Object Safety§

This trait is not object safe.

Implementors§