Skip to main content

SignatureAlgorithm

Trait SignatureAlgorithm 

Source
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>;
}
Expand description

Adapter contract for a detached-signature algorithm.

Required Associated Constants§

Source

const ALG: Algorithm

The algorithm selector this adapter implements.

Required Methods§

Source

fn generate_keypair() -> Result<(Vec<u8>, Zeroizing<Vec<u8>>), AlgorithmError>

Generate a keypair, returning (public_key, secret_key); the secret zeroizes on drop.

Source

fn sign(secret: &[u8], msg: &[u8]) -> Result<Vec<u8>, AlgorithmError>

Sign msg with secret, returning the detached signature bytes.

Source

fn verify(public: &[u8], msg: &[u8], sig: &[u8]) -> Result<(), AlgorithmError>

Verify sig over msg against public; invalid signatures fail closed.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§