Skip to main content

decrypt_message

Function decrypt_message 

Source
pub fn decrypt_message(
    auth_key: &[u8; 256],
    data: &[u8],
    admin: bool,
) -> Result<Vec<u8>, E2eError>
Expand description

Decrypt an incoming secret chat blob.

data is key_fingerprint (8) || msg_key (16) || ciphertext. admin is true when we initiated the chat.

Verifies the key fingerprint, the msg_key (SHA-256 over a fragment of auth_key and the decrypted body), the length prefix and the padding size (12..=1024 bytes). Returns the inner TL bytes without the 4-byte length prefix.