rustls::crypto

Trait 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§