static String encKey = 'oasterw4567ncdsagfhswtoslfiessgv';
static final key = encrypt.Key.fromUtf8(encKey);
static final iv = encrypt.IV.fromLength(16);
static final encrypter = encrypt.Encrypter(
encrypt.AES(key, mode: encrypt.AESMode.cbc, padding: 'PKCS7'));
static encryptAES(text) {
final encrypted = encrypter.encrypt(text, iv: iv);
print("Encrypted " + encrypted.base64);
decryptAES(encrypted.base64);
return encrypted.base64;
}
static decryptAES(encText) {
String original =
encrypter.decrypt(encrypt.Encrypted.from64(encText), iv: iv);
print("Decrypt " + original);
}
<块引用>
这是简单的 AES 算法,但现在客户端需要 aes/cbc/pkcs5padding 那么我该如何转换?