pub trait SignatureScheme<PK, M, SIG> {
// Required methods
fn public_key(&self) -> PK;
fn sign(&mut self, message: M) -> SIG;
fn verify(pk: PK, message: M, signature: &SIG) -> bool;
}Expand description
A generic trait that describes a signature scheme.
The general workflow is:
- Instantiating a signature scheme generates a new key pair. Concrete instantiations have to provide their own way of instantiating themselves.
- The public key is exposed via
public_key() - Messages can be signed using
sign() - Signatures can be verified using
verify()
Required Methods§
Sourcefn public_key(&self) -> PK
fn public_key(&self) -> PK
Returns a copy of the public key
Sourcefn verify(pk: PK, message: M, signature: &SIG) -> bool
fn verify(pk: PK, message: M, signature: &SIG) -> bool
Verifies a signature.
Note that this function does not require need self, hence does not need
an instance of the signature scheme.
This is because an instance of a signature scheme contains the signing key
which is typically not available for the verifier.
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.