pub fn derive_nonce(base: &[u8], counter: u32) -> Result<Nonce, Error>
Expand description

Given a “base” nonce and a counter, returns a Nonce suitable for encrypting/decrypting one block.

Nonces are generated by XOR-ing the last 4 bytes of the base nonce with a 32-bit big-endian representation of the counter. Since Ring currently only supports 96-bit nonces, this method will return Error::InvalidNonceSize if the base nonce is not 12 bytes long. Error::NonceExhaustion is returned if counter is u32::MAX.