/** * AES-128/192/256 in CBC mode with PKCS7 padding. * * **WARNING: CBC mode is unauthenticated.** Always authenticate the output * with HMAC-SHA256 (Encrypt-then-MAC) or use an authenticated cipher * (`XChaCha20Poly1305`, `Seal` with `SerpentCipher`) instead. * * Holds exclusive access to the `aes` WASM module from construction until * `dispose()`. Constructing a second AES-using class while this instance * is live throws. Call `dispose()` when done. */ export declare class AESCbc { private readonly x; private _tok; constructor(opts?: { dangerUnauthenticated: true; }); /** * Encrypt plaintext with AES CBC + PKCS7 padding. * * @param key 16, 24, or 32 bytes (AES-128 / 192 / 256) * @param iv 16 bytes, must be random and unique per (key, message) * @param plaintext any length, PKCS7 padding applied automatically * @returns ciphertext (length = ceil((plaintext.length + 1) / 16) * 16) */ encrypt(key: Uint8Array, iv: Uint8Array, plaintext: Uint8Array): Uint8Array; /** * Decrypt AES CBC + PKCS7. * * All failure modes, empty input, non-multiple-of-16 length, and any * PKCS7 validation failure, throw the same generic `RangeError` with * message `'invalid ciphertext'`. Padding validation runs branch-free * over the last 16 bytes regardless of where the mismatch is, closing * the Vaudenay 2002 padding-oracle surface for callers using * `{ dangerUnauthenticated: true }` without an outer HMAC. */ decrypt(key: Uint8Array, iv: Uint8Array, ciphertext: Uint8Array): Uint8Array; /** Wipe WASM state and release exclusive module access. Idempotent. */ dispose(): void; }