fn_dsa

Trait KeyPairGenerator

Source
pub trait KeyPairGenerator: Default {
    // Required method
    fn keygen<T>(
        &mut self,
        logn: u32,
        rng: &mut T,
        sign_key: &mut [u8],
        vrfy_key: &mut [u8],
    )
       where T: CryptoRng + RngCore;
}
Expand description

Key pair generator and temporary buffers.

Key pair generation uses relatively large temporary buffers (about 25 or 50 kB, for the two standard degrees), which is why they are part of the KeyPairGenerator instance instead of being allocated on the stack. An instance can be used for several successive key pair generations. Implementations of this trait are expected to handle automatic zeroization (overwrite of all contained secret values when the object is released).

Required Methods§

Source

fn keygen<T>( &mut self, logn: u32, rng: &mut T, sign_key: &mut [u8], vrfy_key: &mut [u8], )
where T: CryptoRng + RngCore,

Generate a new key pair.

The random source rng MUST be cryptographically secure. The degree (logn) must be supported by the instance; a panic is triggered otherwise. The new signing and verifying keys are written into sign_key and vrfy_key, respectively; these destination slices MUST have the exact size for their respective contents (see the sign_key_size() and vrfy_key_size() functions).

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.

Implementors§