aesAuthEncrypt function

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

Implementation

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

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

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

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