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 arraynonce
: 12-byte arrayplaintext
: the data to encryptauthenticated_data
: an additional data that is authenticated during encryption
Returns:
the ciphertext if succeeds