Skip to main content

file_decrypt

Function file_decrypt 

Source
pub fn file_decrypt(
    ciphertext: &[u8],
    key: &[u8],
    iv: &[u8],
    size: usize,
) -> Result<Vec<u8>, E2eError>
Expand description

Decrypt file ciphertext with the key and iv from the inner TL media field.

size is the original plaintext length from the DecryptedMedia size field. Decrypts with AES-256-IGE and truncates the result to size.

Fails with E2eError::DecryptionFailed if key or iv is shorter than 32 bytes, the ciphertext is empty or not a multiple of 16 bytes, or size exceeds the decrypted length.