aesAuthEncrypt function

AesAuthEncryptInfos aesAuthEncrypt(
  1. Uint8List data,
  2. Uint8List aesKey,
  3. Uint8List iv
)

Implementation

AesAuthEncryptInfos aesAuthEncrypt(
  Uint8List data,
  Uint8List aesKey,
  Uint8List iv,
) {
  final keyPair =
      crypto_keys.KeyPair.symmetric(crypto_keys.SymmetricKey(keyValue: aesKey));

  final encrypter = keyPair.publicKey!
      .createEncrypter(crypto_keys.algorithms.encryption.aes.gcm);

  final v = encrypter.encrypt(data, initializationVector: iv);

  return AesAuthEncryptInfos(tag: v.authenticationTag, encrypted: v.data);
}