basic_encrypt

Function basic_encrypt 

Source
pub fn basic_encrypt(
    key: &[u8; 32],
    nonce: &[u8; 12],
    plaintext: &[u8],
    associated_data: &[u8],
) -> Result<Vec<u8>, Error>
Expand description

Encrypts plaintext using AES-GCM-SIV algorithm.

§Arguments

  • key - A reference to the 256-bit key for encryption.
  • nonce - A reference to the 12-byte nonce.
  • plaintext - A reference to the data to be encrypted.
  • associated_data - A reference to the associated data.

§Returns

  • Result<Vec<u8>, Error> - The encrypted data as a vector of bytes, or an error if encryption fails.