Chat and exchange pictures
If the version stored on the client is still up-to-date, the server will return the constructor Config Not Modified.Client is expected to check whether p is a safe 2048-bit prime (meaning that both p and (p-1)/2 are prime, and that 2^2047 0) so the server generates its own random sequence random of the appropriate length.Having received g_a from the update with encrypted Chat Requested, it can immediately generate the final shared key: and key_fingerprint.For all of Client B’s authorized devices, except the current one, update Encryption updates are sent with the constructor encrypted Chat Discarded.After User B confirms the creation of a secret chat with A in the client interface, Client B also receives up-to-date configuration parameters for the Diffie-Hellman method.Thereafter, it generates a random 2048-bit number, b, using rules similar to those for a.Encryption key fingerprint key_fingerprint and the message key msg_key are added at the top of the resulting byte array.
As long as the current layer is lower than 73, each party should try to decrypt received messages with MTProto 1.0, and if this is not successfull (msg_key does not match), try MTProto 2.0.
Note that as of version 4.6, major Telegram clients are using MTProto 2.0.
MTProto v.1.0 is deprecated and is currently being phased out.
The resulting array is prepended by 4 bytes containing the array length not counting these 4 bytes.
The byte array is padded with 12 to 1024 random padding bytes to make its length divisible by 16 bytes.
Search for Chat and exchange pictures:
User B receives the update update Encryption for all associated authorization keys (all authorized devices) with the chat constructor encrypted Chat Requested.