pub trait SignatureAlgorithm {
const ALG: Algorithm;
// Required methods
fn generate_keypair( ) -> Result<(Vec<u8>, Zeroizing<Vec<u8>>), AlgorithmError>;
fn sign(secret: &[u8], msg: &[u8]) -> Result<Vec<u8>, AlgorithmError>;
fn verify(
public: &[u8],
msg: &[u8],
sig: &[u8],
) -> Result<(), AlgorithmError>;
// Provided method
fn derive_keypair(
secret: &[u8],
) -> Result<(Vec<u8>, Zeroizing<Vec<u8>>), AlgorithmError> { ... }
}Expand description
Adapter contract for a detached-signature algorithm.
Required Associated Constants§
Required Methods§
Sourcefn generate_keypair() -> Result<(Vec<u8>, Zeroizing<Vec<u8>>), AlgorithmError>
fn generate_keypair() -> Result<(Vec<u8>, Zeroizing<Vec<u8>>), AlgorithmError>
Generate a keypair, returning (public_key, secret_key); the secret
zeroizes on drop.
Provided Methods§
Sourcefn derive_keypair(
secret: &[u8],
) -> Result<(Vec<u8>, Zeroizing<Vec<u8>>), AlgorithmError>
fn derive_keypair( secret: &[u8], ) -> Result<(Vec<u8>, Zeroizing<Vec<u8>>), AlgorithmError>
Reconstruct a keypair from existing secret material.
Algorithms define the exact secret shape: Ed25519, ML-DSA, and similar seed-form keys import a seed, while elliptic-curve algorithms import a private scalar. This path is not password-based key generation.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".