encryptAES method

Uint8List encryptAES(
  1. Uint8List key
)

Implementation

Uint8List encryptAES(Uint8List key) {
  var aesCrypt = AesCryptRaw(key: key, padding: PaddingAES.pkcs7);
  var iv = Uint8List.fromList(List<int>.generate(IV_BYTE_LENGTH, (i) => random.nextInt(256)));
  return (BytesBuilder()
    ..add(iv)
    ..add(aesCrypt.cbc.encrypt(inp: this, iv: iv)))
      .toBytes();
}