encryptAesCbc static method
Criptografa bytes com AES-CBC + PKCS#7 e retorna um EncryptedPayload.
⚠️ Não autenticado — use AES-GCM ou ChaCha20-Poly1305 quando precisar de integridade garantida.
key: 16 bytes (AES-128) ou 32 bytes (AES-256). Padrão: 32 bytes.iv: 16 bytes. Se omitido, gera um IV aleatório seguro.
Implementation
static EncryptedPayload encryptAesCbc(
List<int> bytes, {
Uint8List? key,
Uint8List? iv,
}) =>
AesCbc(
key: key ?? generateKey(),
iv: iv ?? generateIv(),
).encrypt(bytes);