Skip to main content

aes_cbc_decrypt

Function aes_cbc_decrypt 

Source
pub fn aes_cbc_decrypt<'py>(
    py: Python<'py>,
    key: &[u8],
    iv: &[u8],
    ciphertext: &[u8],
    unpad: bool,
) -> PyResult<Bound<'py, PyBytes>>
Expand description

Decrypt data using AES-CBC.

Key length determines the AES variant: 16 → AES-128, 24 → AES-192, 32 → AES-256. iv must be 16 bytes.

When unpad=True (default) PKCS#7 padding is stripped automatically. When unpad=False the raw decrypted bytes are returned.

import synta

pt = synta.aes_cbc_decrypt(key_32, iv_16, ciphertext)
pt_raw = synta.aes_cbc_decrypt(key_16, iv_16, ciphertext, unpad=False)