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§
sourcetype PrivateKey: PrivateKey
type PrivateKey: PrivateKey
The private key type used to generate this signature.
Required Methods§
sourcefn sign(key: &Self::PrivateKey, message: &[u8]) -> Result<Self, Error>
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.
sourcefn is_valid(
&self,
key: &<Self::PrivateKey as PrivateKey>::Public,
message: &[u8],
) -> bool
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.