Skip to content

miniproto.crypto.mtproto.media_cbc_decrypt

miniproto.crypto.mtproto.media_cbc_decrypt

Section titled “miniproto.crypto.mtproto.media_cbc_decrypt”
media_cbc_decrypt(ciphertext: BytesLike, key: bytes, iv: bytes) -> bytes

Decrypt block-aligned AES-256-CBC media data without unpadding it.

Parameters:

  • ciphertext (BytesLike) – Bytes whose length is a multiple of 16.
  • key (bytes) – Exactly 32 bytes of AES-256 key material.
  • iv (bytes) – Exactly 16 bytes of initialization value.

Returns:

  • bytes – The raw decrypted bytes.

Raises:

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

CBC decryption here supplies confidentiality transformation only; it does not authenticate the input. Validate integrity at the protocol layer.