Ensure that CBC is always the chosen mode of encryption

This commit is contained in:
Vishnu Mohandas 2020-09-10 02:17:51 +05:30
parent 4cd93610f7
commit d9a583a46c

View file

@ -26,7 +26,7 @@ class CryptoUtil {
static Uint8List aesEncrypt(
Uint8List plainText, Uint8List key, Uint8List iv) {
final encrypter = AES(Key(key));
final encrypter = AES(Key(key), mode: AESMode.cbc);
return encrypter
.encrypt(
plainText,
@ -37,7 +37,7 @@ class CryptoUtil {
static String decryptFromBase64(
String base64CipherText, String base64Key, String base64IV) {
final encrypter = AES(Key.fromBase64(base64Key));
final encrypter = AES(Key.fromBase64(base64Key), mode: AESMode.cbc);
return utf8.decode(encrypter.decrypt(
Encrypted.fromBase64(base64CipherText),
iv: IV.fromBase64(base64IV),