- High-height role (API query words): talks of the process wherein API inquiries and you can responses is actually converted to digital texts.
- Cryptographic (authorization) layer: defines the process wherein messages try encoded prior to becoming transmitted from the transportation method.
- Transportation role: describes the procedure with the client and the servers to send texts more than some other existing network protocol (eg HTTP, HTTPS, WS (basic websockets), WSS (websockets over HTTPS), TCP, UDP).
Since adaptation 4.6, big Telegram clients are having fun with MTProto 2.0, explained in this post. MTProto v1.0 (demonstrated right here to possess site) try deprecated that will be increasingly being phased out.
The method is perfect for access to a server API regarding software powered by mobile devices
In the standpoint of one’s highest-height role, the customer plus the machine replace texts into the an appointment. The concept is linked to the customer equipment (the program, to get much more accurate) instead of a specific websocket/http/https/tcp relationship. At exactly the same time, for each and every concept is actually connected with a user key ID where agreement is actually complete.
Multiple connections to a server may be unlock; messages are submitted either assistance compliment of all relationships (a reaction to a query is not always came back from the same commitment that transmitted the initial query, even in the event frequently, that’s the circumstances; not, inside the no instance is a message end up being returned as a consequence of an association belonging to a different sort of concept). In the event that UDP process is used, an answer might be came back by the a different sort of Internet protocol address than simply the only to which the brand new ask was actually delivered.
- RPC phone calls (consumer to host): phone calls to API actions
- RPC responses (machine in order to consumer): consequence of RPC phone calls
- Content obtained bill (or in other words, notification out of condition of some messages)
- Message status inquire
- Multipart content otherwise basket (a container you to retains several messages; needed seriously to post numerous RPC calls at once more an enthusiastic HTTP commitment, such as for example; as well as, a container may service gzip).
The message secret is understood to be new 128 middle pieces of the newest SHA256 of your message muscles (and additionally class, message ID, etc
Regarding the viewpoint of straight down height standards, a message is a digital data weight lined up collectively a good 4 or sixteen-byte line. The original several industries regarding the content is actually fixed and so are utilized by the latest cryptographic/authorization system.
For each content, often individual otherwise in to the a container, contains a contact identifier (64 bits, select below), a contact sequence count within this a session (thirty two pieces), the distance (of your content body for the bytes; 32 bits), and you can a body (people proportions that’s a parallel out-of 4 bytes). Likewise, whenever a bin otherwise a single content is sent, an interior heading is extra on top (select less than), then the entire message is encrypted, and you will an outward header is put towards the top of brand new content (good 64-part secret identifier and you may a beneficial 128-bit content trick).
A contact human body usually include a one night friend app good 32-piece content form of followed closely by variety of-centered parameters. Particularly, each RPC mode enjoys a matching message sorts of. To get more outline, select Digital Research Serialization, Mobile Protocol: Provider Messages.
All the number is actually written as little endian. But not, very big numbers (2048-bit) utilized in RSA and you can DH try written in the top endian style for the reason that it is when this new OpenSSL collection can it.
Just before a contact (otherwise a beneficial multipart message) being sent more a network using a delivery method, it’s encrypted from inside the a certain method, and you will an outward heading try added near the top of the newest content which is: an excellent 64-portion trick identifier (you to exclusively identifies an approval secret for the host too because the associate) and an effective 128-part message trick. A user secret because of the content trick represent an authentic 256-part secret which is exactly what encrypts the message having fun with AES-256 security. Keep in mind that the initial a portion of the content to be encrypted include varying research (course, message ID, sequence count, servers salt) you to definitely of course affects the content key (for example the latest AES secret and you may iv). ), such as the cushioning bytes, prepended because of the 32 bytes extracted from the consent trick. Multipart messages is actually encrypted just like the a single message.