pub trait SecureRandom:
Send
+ Sync
+ Debug {
// Required method
fn fill(&self, buf: &mut [u8]) -> Result<(), GetRandomFailed>;
// Provided method
fn fips(&self) -> bool { ... }
}展开描述
密码学安全的随机数材源
必需方法§
Sourcefn fill(&self, buf: &mut [u8]) -> Result<(), GetRandomFailed>
fn fill(&self, buf: &mut [u8]) -> Result<(), GetRandomFailed>
Fill the given 缓冲区 with random bytes.
此 bytes must be sourced 从 一个 cryptographically secure random number generator seeded with good quality, secret entropy.
This is 用 用于 all randomness required by rustls, but not necessarily
randomness required by 底层 cryptography library. For example:
SupportedKxGroup::start() requires random material 到 generate
an ephemeral key exchange key, but this is not included in the interface with
rustls: it is assumed that the cryptography library provides 用于 this itself.