> Aztec.nr API reference, v6.0.0 (mainnet and testnet). Index: https://docs.aztec.network/aztec-nr-api/v6.0.0/llms.txt

# Function try_aes128_decrypt

Module: `noir_aztec::oracle::aes128_decrypt`

```rust
pub unconstrained fn try_aes128_decrypt<let N: u32>(
    ciphertext: BoundedVec<u8, N>,
    iv: [u8; 16],
    sym_key: [u8; 16],
) -> Option<BoundedVec<u8, N>>
```

Attempts to decrypt a ciphertext using AES128.

Returns `Option::some(plaintext)` on success, or `Option::none()` if decryption fails (e.g. due to malformed ciphertext or invalid PKCS#7 padding). Note that decryption with the wrong key will almost always return `None` because the decrypted garbage data will have invalid PKCS#7 padding.

Note that we accept ciphertext as a BoundedVec, not as an array. This is because this function is typically used when processing logs and at that point we don't have comptime information about the length of the ciphertext as the log is not specific to any individual note.
