decrypt function

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

Implementation

Uint8List decrypt(Uint8List ciphertext, Uint8List key, Uint8List iv) {
  CBCBlockCipher cipher =  CBCBlockCipher(AESEngine());
  ParametersWithIV<KeyParameter> params = ParametersWithIV<KeyParameter>( KeyParameter(key), iv);
  PaddedBlockCipherParameters<ParametersWithIV<KeyParameter>, Null> paddingParams =  PaddedBlockCipherParameters<ParametersWithIV<KeyParameter>, Null>(params, null);
  PaddedBlockCipherImpl paddingCipher = PaddedBlockCipherImpl(PKCS7Padding(), cipher);
  paddingCipher.init(false, paddingParams);
  return paddingCipher.process(ciphertext);
}