Function openssl::rand::rand_priv_bytes

source ·
pub fn rand_priv_bytes(buf: &mut [u8]) -> Result<(), ErrorStack>
Expand description

Fill buffer with cryptographically strong pseudo-random bytes. It is intended to be used for generating values that should remain private.

Examples

To generate a buffer with cryptographically strong random bytes:

use openssl::rand::rand_priv_bytes;

let mut buf = [0; 256];
rand_priv_bytes(&mut buf).unwrap();

Requires OpenSSL 1.1.1 or newer.

This corresponds to RAND_priv_bytes.