Trait rustls::crypto::SecureRandom

source ·
pub trait SecureRandom:
    Send
    + Sync
    + Debug {
    // Required method
    fn fill(&self, buf: &mut [u8]) -> Result<(), GetRandomFailed>;

    // Provided method
    fn fips(&self) -> bool { ... }
}
Expand description

A source of cryptographically secure randomness.

Required Methods§

source

fn fill(&self, buf: &mut [u8]) -> Result<(), GetRandomFailed>

Fill the given buffer with random bytes.

The bytes must be sourced from a cryptographically secure random number generator seeded with good quality, secret entropy.

This is used for all randomness required by rustls, but not necessarily randomness required by the underlying cryptography library. For example: SupportedKxGroup::start() requires random material to generate an ephemeral key exchange key, but this is not included in the interface with rustls: it is assumed that the cryptography library provides for this itself.

Provided Methods§

source

fn fips(&self) -> bool

Return true if this is backed by a FIPS-approved implementation.

Implementors§