decrypt function

Uint8List decrypt(
  1. Uint8List ciphertext,
  2. Uint8List key,
  3. Uint8List iv
)

Implementation

Uint8List decrypt(Uint8List ciphertext, Uint8List key, Uint8List iv) {
  final cipher = CBCBlockCipher(AESEngine());
  final params = ParametersWithIV<KeyParameter>(KeyParameter(key), iv);
  final paddingParams = PaddedBlockCipherParameters(params, null);
  final paddingCipher = PaddedBlockCipherImpl(PKCS7Padding(), cipher);

  paddingCipher.init(false, paddingParams);
  return paddingCipher.process(ciphertext);
}