跳到主要内容

SecureRandom

特性 SecureRandom 

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

    // Provided method
    fn fips(&self) -> bool { ... }
}
展开描述

密码学安全的随机数材源

必需方法§

Source

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.

提供方法§

Source

fn fips(&self) -> bool

Return true if this is 由 FIPS 批准的实现支持。

实现者§