aesCbcPkcs7Decrypt method

Uint8List aesCbcPkcs7Decrypt({
  1. required Uint8List ciphertext,
  2. required Uint8List key,
  3. required Uint8List iv,
})
inherited

Convenience helper that decrypts using AES-CBC with PKCS#7 padding.

Supports AES-128 (16-byte key) and AES-256 (32-byte key).

Implementation

Uint8List aesCbcPkcs7Decrypt({
  required Uint8List ciphertext,
  required Uint8List key,
  required Uint8List iv,
}) {
  if (key.length == 16) {
    return aes128CbcDecrypt(ciphertext: ciphertext, key: key, iv: iv);
  }
  if (key.length == 32) {
    return aes256CbcDecrypt(ciphertext: ciphertext, key: key, iv: iv);
  }
  throw ArgumentError('Key must be 16 or 32 bytes for AES-CBC');
}