decrypt method
List<int>
decrypt(
- EncryptedData encryptedData
)
Implementation
@override
List<int> decrypt(EncryptedData encryptedData) {
if (encryptedData.data.isEmpty) {
throw CryptoException('decryption error: empty content');
}
var encrypter = crypto.Encrypter(
crypto.AES(_getKey(), mode: crypto.AESMode.cbc),
);
try {
return encrypter.decryptBytes(
crypto.Encrypted(Uint8List.fromList(encryptedData.data.toList())),
iv: crypto.IV(Uint8List.fromList(encryptedData.metadata.toList())));
} catch (e) {
_logger.warning('AES-CBC decryption failed: $e');
throw CryptoException(_decryptionErrorMessage);
}
}