aesDecrypt static method

dynamic aesDecrypt(
  1. dynamic encrypted,
  2. String keyStr, {
  3. required String ivStr,
})

Implementation

static dynamic aesDecrypt(encrypted, String keyStr, {required String ivStr}) {
  try {
    final key = encrypt.Key.fromUtf8(keyStr);
    final iv = encrypt.IV.fromUtf8(ivStr);
    final encrypter = encrypt.Encrypter(encrypt.AES(key, mode: encrypt.AESMode.cbc));
    final decrypted = encrypter.decrypt64(encrypted, iv: iv);
    return decrypted;
  } catch (err) {
    print("aes decode error:$err");
    return encrypted;
  }
}