aes_encrypt

Function aes_encrypt 

Source
pub fn aes_encrypt<K: AsRef<EncryptionKey>>(
    data: &mut [u8],
    key: K,
    nonce: K,
) -> Result<(), InvalidKeyNonceLength>
Expand description

Encrypts the specified data with the AES CFB cipher.

§Parameters

  • data: The plaintext data buffer. After this function has been called, it will store the encrypted data.
  • key: The encryption key. It must be exactly 32 bytes.
  • nonce: The unique nonce. It must be exactly 16 bytes.

§Returns

If the data could be successfully encrypted Ok(()) will be returned. If the key or nonce are invalid, Err(InvalidKeyNonceLength) will be returned.