aesCbcPkcs7Encrypt method

Uint8List aesCbcPkcs7Encrypt({
  1. required Uint8List data,
  2. required Uint8List key,
  3. required Uint8List iv,
})
inherited

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

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

Implementation

Uint8List aesCbcPkcs7Encrypt({
  required Uint8List data,
  required Uint8List key,
  required Uint8List iv,
}) {
  if (key.length == 16) {
    return aes128CbcEncrypt(data: data, key: key, iv: iv);
  }
  if (key.length == 32) {
    return aes256CbcEncrypt(data: data, key: key, iv: iv);
  }
  throw ArgumentError('Key must be 16 or 32 bytes for AES-CBC');
}