pub trait RandomBackend: Backend {
// Required method
fn generate_random(&mut self, len: usize) -> Result<Vec<u8>, BackendError>;
}Expand description
Hardware or software random number generation.
Backends implementing this trait can generate random bytes. For HSM
backends, this uses the device’s internal RNG (e.g., PKCS#11 C_GenerateRandom).
Required Methods§
Sourcefn generate_random(&mut self, len: usize) -> Result<Vec<u8>, BackendError>
fn generate_random(&mut self, len: usize) -> Result<Vec<u8>, BackendError>
Generate len random bytes.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".