decryptAES static method

Map decryptAES(
  1. String encryptedString,
  2. String aesKey,
  3. String priKey
)

Implementation

static Map decryptAES(String encryptedString, String aesKey, String priKey) {
  // AES 需要的密钥和 IV
  final key = encrypt.Key.fromUtf8(aesKey);
  final ivstr = priKey.replaceAll(RegExp(r'[\r\n]+'), "").substring(26, 42);
  final iv = encrypt.IV.fromUtf8(ivstr);
  final encrypter = encrypt.Encrypter(
      encrypt.AES(key, mode: encrypt.AESMode.cbc)); // 使用 CBC 模式
  final decrypted = encrypter.decrypt64(encryptedString, iv: iv);
  return jsonDecode(decrypted);
}