Function try_aes128_decrypt
pub unconstrained fn try_aes128_decrypt<let N: u32>(
ciphertext: BoundedVec<u8, N>,
iv: [u8; 16],
sym_key: [u8; 16],
) -> Option<BoundedVec<u8, N>>
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, orOption::none()if decryption fails (e.g. due to malformed ciphertext). Note that decryption with the wrong key will still returnSomewith garbage data, it's up to the calling function to verify correctness (e.g. via a MAC check).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.