String data,
String key
) String key
Decrypt String data with a key Key length must be 128/192/256 bits
Source
/// Decrypt String data with a key
/// Key length must be 128/192/256 bits
String decrypt(String data, String key) {
initSymCrypt();
if (data == null || data.isEmpty) {
return null;
}
Uint8List _key = new Uint8List.fromList(key.codeUnits);
var iv = new Uint8List.fromList(
[0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77]
);
var params = new ParametersWithIV(new KeyParameter( _key ), iv);
var cipher = new StreamCipher("AES/CTR")
..init(false, params);
Uint8List cipherData = cipher.process(new Uint8List.fromList(data.codeUnits));
return new String.fromCharCodes(cipherData);
}