Function cloudproof_aesgcm::encrypt

source ·
pub fn encrypt(
    key: &[u8],
    nonce: &[u8],
    plaintext: &[u8],
    authenticated_data: &[u8]
) -> Result<Vec<u8>, AesGcmError>
Expand description

The encrypt function parameters are:

Arguments:

  • key: 32-byte array
  • nonce: 12-byte array
  • plaintext: the data to encrypt
  • authenticated_data: an additional data that is authenticated during encryption

Returns:

the ciphertext if succeeds