pub trait Signature {
type VerifyingKey;
type SigningKey;
type Sig;
// Required methods
fn keygen<R: CryptoRng + ?Sized>(
rng: &mut R,
) -> Result<(Self::VerifyingKey, Self::SigningKey)>;
fn sign<R: CryptoRng + ?Sized>(
sk: &Self::SigningKey,
msg: &[u8],
ctx: &[u8],
rng: &mut R,
) -> Result<Self::Sig>;
fn verify(
vk: &Self::VerifyingKey,
msg: &[u8],
ctx: &[u8],
sig: &Self::Sig,
) -> Result<()>;
}Expand description
Uniform interface for post-quantum Digital Signature Schemes.
§Secret-Output Staging Note
Returning secret signing keys by value (-> Result<...>) in safe Rust can leave an unzeroized
copy in a callee’s return staging slot when moved into the caller’s return place.
Zeroization-critical callers (including quantaegis-fips) should prefer concrete in-place
keygen_into (and sign_into for direct buffer output) methods where provided by the
parameter set.
Required Associated Types§
Sourcetype VerifyingKey
type VerifyingKey
Public verifying key type.
Sourcetype SigningKey
type SigningKey
Private signing key type (must zeroize on drop).
Required Methods§
Sourcefn keygen<R: CryptoRng + ?Sized>(
rng: &mut R,
) -> Result<(Self::VerifyingKey, Self::SigningKey)>
fn keygen<R: CryptoRng + ?Sized>( rng: &mut R, ) -> Result<(Self::VerifyingKey, Self::SigningKey)>
Generates a fresh (VerifyingKey, SigningKey) key pair using rng.
For zeroization-critical callers avoiding safe-Rust return-slot staging copies of the
signing key, prefer the concrete parameter set’s keygen_into method.
Sourcefn sign<R: CryptoRng + ?Sized>(
sk: &Self::SigningKey,
msg: &[u8],
ctx: &[u8],
rng: &mut R,
) -> Result<Self::Sig>
fn sign<R: CryptoRng + ?Sized>( sk: &Self::SigningKey, msg: &[u8], ctx: &[u8], rng: &mut R, ) -> Result<Self::Sig>
Signs msg with optional domain-separation context string ctx (at most 255 bytes in
FIPS 204/205) using fresh randomness from rng (hedged mode).
Callers writing directly into a caller-owned byte buffer can prefer the concrete signing
key’s sign_into method where available.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".