Trait rustls::crypto::SecureRandom
source · pub trait SecureRandom:
Send
+ Sync
+ Debug {
// Required method
fn fill(&self, buf: &mut [u8]) -> Result<(), GetRandomFailed>;
}
Expand description
A source of cryptographically secure randomness.
Required Methods§
sourcefn fill(&self, buf: &mut [u8]) -> Result<(), GetRandomFailed>
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.