encrypt static method
Implementation
static Map<String,Uint8List> encrypt(Uint8List plainBytes){
//General 16-byte IV (same as AES default)
final iv = enc.IV.fromSecureRandom(16);
final encrypter = enc.Encrypter(enc.AES(_key,mode: enc.AESMode.cbc));
final encrypted = encrypter.encryptBytes(
plainBytes,iv: iv
);
return {
"iv": iv.bytes,
"ciphertext": Uint8List.fromList(encrypted.bytes),
};
}