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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".