Skip to content

miniproto.crypto.native.aes_256_cbc_encrypt

miniproto.crypto.native.aes_256_cbc_encrypt

Section titled “miniproto.crypto.native.aes_256_cbc_encrypt”
aes_256_cbc_encrypt(plaintext: bytes, key: bytes, iv: bytes) -> bytes

Encrypt block-aligned bytes with AES-256-CBC.

Parameters:

  • plaintext (bytes) – Bytes whose length is a multiple of 16; no padding is added.
  • key (bytes) – Exactly 32 bytes of AES-256 key material.
  • iv (bytes) – Exactly 16 bytes of initialization value.

Returns:

  • bytes – Ciphertext equal in length to plaintext.

Raises:

  • ValueError – If key/IV lengths or block alignment are invalid.

The caller owns padding and IV uniqueness. CBC has no authenticity here; dispatch prefers cryptography when available for the measured media path.