mirror of
https://github.com/MarshalX/telegram-crawler.git
synced 2024-12-11 09:23:40 +01:00
752 lines
34 KiB
HTML
752 lines
34 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html class="">
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<title>samples-auth_key</title>
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
<meta property="description" content="In the examples below, the transport headers are omitted:
|
||
|
For example, for an abridged version of the transport the client…">
|
||
|
<meta property="og:title" content="samples-auth_key">
|
||
|
<meta property="og:image" content="71a15765997de28d38">
|
||
|
<meta property="og:description" content="In the examples below, the transport headers are omitted:
|
||
|
For example, for an abridged version of the transport the client…">
|
||
|
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
|
||
|
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
|
||
|
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
|
||
|
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
|
||
|
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
|
||
|
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
|
||
|
|
||
|
<link href="/css/telegram.css?230" rel="stylesheet" media="screen">
|
||
|
<style>
|
||
|
</style>
|
||
|
</head>
|
||
|
<body class="preload">
|
||
|
<div class="dev_page_wrap">
|
||
|
<div class="dev_page_head navbar navbar-static-top navbar-tg">
|
||
|
<div class="navbar-inner">
|
||
|
<div class="container clearfix">
|
||
|
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
|
||
|
<ul class="nav navbar-nav">
|
||
|
<li><a href="//telegram.org/">Home</a></li>
|
||
|
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
|
||
|
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
|
||
|
<li class=""><a href="/api">API</a></li>
|
||
|
<li class="active"><a href="/mtproto">Protocol</a></li>
|
||
|
<li class=""><a href="/schema">Schema</a></li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="container clearfix">
|
||
|
<div class="dev_page">
|
||
|
<div id="dev_page_content_wrap" class=" ">
|
||
|
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/mtproto" >Mobile Protocol</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/mtproto/samples-auth_key" >samples-auth_key</a></li></ul></div>
|
||
|
<h1 id="dev_page_title">samples-auth_key</h1>
|
||
|
|
||
|
<div id="dev_page_content"><p>In the examples below, the <a href="/mtproto#transport">transport</a> headers are omitted:</p>
|
||
|
<blockquote>
|
||
|
<p>For example, for an abridged version of the transport the client sends <code>0xef</code> as the first byte (<strong>important:</strong> only prior to the very first data packet), then packet length is encoded by a single byte (<code>0x01-0x7e</code> = data length divided by 4; or <code>0x7f</code> followed by 3 bytes (little endian) divided by 4) followed by the data themselves. In this case, server responses have the same form (although the server does not send <code>0xef</code>as the first byte).</p>
|
||
|
</blockquote>
|
||
|
<p>Detailed documentation on creating authorization keys is available <a href="/mtproto/auth_key">here »</a>.</p>
|
||
|
<h4><a class="anchor" href="#1-request-for-pq-authorization" id="1-request-for-pq-authorization" name="1-request-for-pq-authorization"><i class="anchor-icon"></i></a>1. Request for (p,q) Authorization</h4>
|
||
|
<pre><code>req_pq#60469778 nonce:int128 = ResPQ</code></pre>
|
||
|
<table class="table">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>Parameter</th>
|
||
|
<th>Offset, Length in bytes</th>
|
||
|
<th>Value</th>
|
||
|
<th>Description</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>auth_key_id</td>
|
||
|
<td>0, 8</td>
|
||
|
<td><code>0</code></td>
|
||
|
<td>Since message is in plain text</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>message_id</td>
|
||
|
<td>8, 8</td>
|
||
|
<td><code>51e57ac42770964a</code></td>
|
||
|
<td>Exact unixtime * 2^32</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>message_length</td>
|
||
|
<td>16, 4</td>
|
||
|
<td><code>20</code></td>
|
||
|
<td>Message body length</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>%(req_pq)</td>
|
||
|
<td>20, 4</td>
|
||
|
<td><code>60469778</code></td>
|
||
|
<td>req_pq constructor number from TL schema</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>nonce</td>
|
||
|
<td>24, 16</td>
|
||
|
<td><code>3E0549828CCA27E966B301A48FECE2FC</code></td>
|
||
|
<td>Random number</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
<p>The header is 20 bytes long, the message body is 20 bytes long, and the entire message is 40 bytes in length.</p>
|
||
|
<pre><code>0000 | 00 00 00 00 00 00 00 00 4A 96 70 27 C4 7A E5 51
|
||
|
0010 | 14 00 00 00 78 97 46 60 3E 05 49 82 8C CA 27 E9
|
||
|
0020 | 66 B3 01 A4 8F EC E2 FC</code></pre>
|
||
|
<h4><a class="anchor" href="#2-a-response-from-the-server-has-been-received-with-the-following-content" id="2-a-response-from-the-server-has-been-received-with-the-following-content" name="2-a-response-from-the-server-has-been-received-with-the-following-content"><i class="anchor-icon"></i></a>2. A response from the server has been received with the following content:</h4>
|
||
|
<pre><code>0000 | 00 00 00 00 00 00 00 00 01 C8 83 1E C9 7A E5 51
|
||
|
0010 | 40 00 00 00 63 24 16 05 3E 05 49 82 8C CA 27 E9
|
||
|
0020 | 66 B3 01 A4 8F EC E2 FC A5 CF 4D 33 F4 A1 1E A8
|
||
|
0030 | 77 BA 4A A5 73 90 73 30 08 17 ED 48 94 1A 08 F9
|
||
|
0040 | 81 00 00 00 15 C4 B5 1C 01 00 00 00 21 6B E8 6C
|
||
|
0050 | 02 2B B4 C3</code></pre>
|
||
|
<h5><a class="anchor" href="#response-decomposition-using-the-following-formula" id="response-decomposition-using-the-following-formula" name="response-decomposition-using-the-following-formula"><i class="anchor-icon"></i></a>Response decomposition using the following formula:</h5>
|
||
|
<pre><code>resPQ#05162463 nonce:int128 server_nonce:int128 pq:string server_public_key_fingerprints:Vector long = ResPQ </code></pre>
|
||
|
<table class="table">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>Parameter</th>
|
||
|
<th>Offset, Length in bytes</th>
|
||
|
<th>Value</th>
|
||
|
<th>Description</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>auth_key_id</td>
|
||
|
<td>0, 8</td>
|
||
|
<td><code>0</code></td>
|
||
|
<td>Since message is in plain text</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>message_id</td>
|
||
|
<td>8, 8</td>
|
||
|
<td><code>51E57AC91E83C801</code></td>
|
||
|
<td>Server message ID</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>message_length</td>
|
||
|
<td>16, 4</td>
|
||
|
<td><code>64</code></td>
|
||
|
<td>Message body length</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>%(resPQ)</td>
|
||
|
<td>20, 4</td>
|
||
|
<td><code>05162463</code></td>
|
||
|
<td>resPQ constructor number from TL schema</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>nonce</td>
|
||
|
<td>24, 16</td>
|
||
|
<td><code>3E0549828CCA27E966B301A48FECE2FC</code></td>
|
||
|
<td>Value generated by client in Step 1</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>server_nonce</td>
|
||
|
<td>40, 16</td>
|
||
|
<td><code>A5CF4D33F4A11EA877BA4AA573907330</code></td>
|
||
|
<td>Server-generated random number</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>pq</td>
|
||
|
<td>56, 12</td>
|
||
|
<td><code>17ED48941A08F981</code></td>
|
||
|
<td>Single-byte prefix denoting length, an 8-byte string, and three bytes of padding</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>%(Vector long)</td>
|
||
|
<td>68, 4</td>
|
||
|
<td><code>1cb5c415</code></td>
|
||
|
<td><em>Vector long</em> constructor number from TL schema</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>count</td>
|
||
|
<td>72, 4</td>
|
||
|
<td><code>1</code></td>
|
||
|
<td>Number of elements in key fingerprint list</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>fingerprints[]</td>
|
||
|
<td>76, 8</td>
|
||
|
<td><code>c3b42b026ce86b21</code></td>
|
||
|
<td>64 lower-order bits of SHA1 (server_public_key)</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
<p>The <strong>server_public_key</strong> public key has been selected whose fingerprint corresponds to the only one received from the server: <code>c3b42b026ce86b21</code>.</p>
|
||
|
<h4><a class="anchor" href="#3-pq--17ed48941a08f981-decomposed-into-2-prime-cofactors" id="3-pq--17ed48941a08f981-decomposed-into-2-prime-cofactors" name="3-pq--17ed48941a08f981-decomposed-into-2-prime-cofactors"><i class="anchor-icon"></i></a>3. Pq = 17ED48941A08F981 decomposed into 2 prime cofactors:</h4>
|
||
|
<pre><code>p = 494C553B
|
||
|
q = 53911073</code></pre>
|
||
|
<h4><a class="anchor" href="#4-encrypted-data-generation" id="4-encrypted-data-generation" name="4-encrypted-data-generation"><i class="anchor-icon"></i></a>4. encrypted_data Generation</h4>
|
||
|
<pre><code>p_q_inner_data#83c95aec pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 = P_Q_inner_data</code></pre>
|
||
|
<table class="table">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>Parameter</th>
|
||
|
<th>Offset, Length in bytes</th>
|
||
|
<th>Value</th>
|
||
|
<th>Description</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>%(p_q_inner_data)</td>
|
||
|
<td>0, 4</td>
|
||
|
<td><code>83c95aec</code></td>
|
||
|
<td>p_q_inner_data constructor number from TL schema</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>pq</td>
|
||
|
<td>4, 12</td>
|
||
|
<td><code>17ED48941A08F981</code></td>
|
||
|
<td>Single-byte prefix denoting length, 8-byte string, and three bytes of padding</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>p</td>
|
||
|
<td>16, 8</td>
|
||
|
<td><code>494C553B</code></td>
|
||
|
<td>First prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>q</td>
|
||
|
<td>24, 8</td>
|
||
|
<td><code>53911073</code></td>
|
||
|
<td>Second prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>nonce</td>
|
||
|
<td>32, 16</td>
|
||
|
<td><code>3E0549828CCA27E966B301A48FECE2FC</code></td>
|
||
|
<td>Value generated by client in Step 1</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>server_nonce</td>
|
||
|
<td>48, 16</td>
|
||
|
<td><code>A5CF4D33F4A11EA877BA4AA573907330</code></td>
|
||
|
<td>Value received from server in Step 2</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>new_nonce</td>
|
||
|
<td>64, 32</td>
|
||
|
<td><code>311C85DB234AA2640AFC4A76A735CF5B</code> <code>1F0FD68BD17FA181E1229AD867CC024D</code></td>
|
||
|
<td>Client-generated random number</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
<p>The serialization of <em>P_Q_inner_data</em> produces some string <strong>data</strong>. This is followed by <strong>encrypted_data</strong>:</p>
|
||
|
<pre><code>SHA1 (data) = DB761C27718A2305044F71F2AD951629D78B2449
|
||
|
RSA (data_with_hash, server_public_key) = 7BB0100A523161904D9C69FA04BC60DECFC5DD74B99995C768EB60D8716E2109BAF2D4601DAB6B09610DC11067BB89021E09471FCFA52DBD0F23204AD8CA8B012BF40A112F44695AB6C266955386114EF5211E6372227ADBD34995D3E0E5FF02EC63A43F9926878962F7C570E6A6E78BF8366AF917A5272675C46064BE62E3E202EFA8B1ADFB1C32A898C2987BE27B5F31D57C9BB963ABCB734B16F652CEDB4293CBB7C878A3A3FFAC9DBEA9DF7C67BC9E9508E111C78FC46E057F5C65ADE381D91FEE430A6B576A99BDF8551FDB1BE2B57069B1A45730618F27427E8A04720B4971EF4A9215983D68F2830C3EAA6E40385562F970D38A05C9F1246DC33438E6</code></pre>
|
||
|
<p>The length of the final string was 256 bytes.</p>
|
||
|
<h5><a class="anchor" href="#request-to-start-diffie-hellman-key-exchange" id="request-to-start-diffie-hellman-key-exchange" name="request-to-start-diffie-hellman-key-exchange"><i class="anchor-icon"></i></a>Request to Start Diffie-Hellman Key Exchange</h5>
|
||
|
<pre><code>req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:string q:string public_key_fingerprint:long encrypted_data:string = Server_DH_Params</code></pre>
|
||
|
<table class="table">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>Parameter</th>
|
||
|
<th>Offset, Length in bytes</th>
|
||
|
<th>Value</th>
|
||
|
<th>Description</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>auth_key_id</td>
|
||
|
<td>0, 8</td>
|
||
|
<td><code>0</code></td>
|
||
|
<td>Since message is in plain text</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>message_id</td>
|
||
|
<td>8, 8</td>
|
||
|
<td><code>51e57ac917717a27</code></td>
|
||
|
<td>Exact unixtime * 2^32</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>message_length</td>
|
||
|
<td>16, 4</td>
|
||
|
<td><code>320</code></td>
|
||
|
<td>Message body length</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>%(req_DH_params)</td>
|
||
|
<td>20, 4</td>
|
||
|
<td><code>d712e4be</code></td>
|
||
|
<td>req_DH_params constructor number from TL schema</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>nonce</td>
|
||
|
<td>24, 16</td>
|
||
|
<td><code>3E0549828CCA27E966B301A48FECE2FC</code></td>
|
||
|
<td>Value generated by client in Step 1</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>server_nonce</td>
|
||
|
<td>40, 16</td>
|
||
|
<td><code>A5CF4D33F4A11EA877BA4AA573907330</code></td>
|
||
|
<td>Value received from server in Step 2</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>p</td>
|
||
|
<td>56, 8</td>
|
||
|
<td><code>494C553B</code></td>
|
||
|
<td>First prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>q</td>
|
||
|
<td>64, 8</td>
|
||
|
<td><code>53911073</code></td>
|
||
|
<td>Second prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>public_key_fingerprint</td>
|
||
|
<td>72, 8</td>
|
||
|
<td><code>c3b42b026ce86b21</code></td>
|
||
|
<td>Fingerprint of public key used</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>encrypted_data</td>
|
||
|
<td>80, 260</td>
|
||
|
<td>See above</td>
|
||
|
<td>See <a href="#4-generatsiya-encrypted-data">“Generation of encrypted_data"</a></td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
<pre><code>0000 | 00 00 00 00 00 00 00 00 27 7A 71 17 C9 7A E5 51
|
||
|
0010 | 40 01 00 00 BE E4 12 D7 3E 05 49 82 8C CA 27 E9
|
||
|
0020 | 66 B3 01 A4 8F EC E2 FC A5 CF 4D 33 F4 A1 1E A8
|
||
|
0030 | 77 BA 4A A5 73 90 73 30 04 49 4C 55 3B 00 00 00
|
||
|
0040 | 04 53 91 10 73 00 00 00 21 6B E8 6C 02 2B B4 C3
|
||
|
0050 | FE 00 01 00 7B B0 10 0A 52 31 61 90 4D 9C 69 FA
|
||
|
0060 | 04 BC 60 DE CF C5 DD 74 B9 99 95 C7 68 EB 60 D8
|
||
|
0070 | 71 6E 21 09 BA F2 D4 60 1D AB 6B 09 61 0D C1 10
|
||
|
0080 | 67 BB 89 02 1E 09 47 1F CF A5 2D BD 0F 23 20 4A
|
||
|
0090 | D8 CA 8B 01 2B F4 0A 11 2F 44 69 5A B6 C2 66 95
|
||
|
00A0 | 53 86 11 4E F5 21 1E 63 72 22 7A DB D3 49 95 D3
|
||
|
00B0 | E0 E5 FF 02 EC 63 A4 3F 99 26 87 89 62 F7 C5 70
|
||
|
00C0 | E6 A6 E7 8B F8 36 6A F9 17 A5 27 26 75 C4 60 64
|
||
|
00D0 | BE 62 E3 E2 02 EF A8 B1 AD FB 1C 32 A8 98 C2 98
|
||
|
00E0 | 7B E2 7B 5F 31 D5 7C 9B B9 63 AB CB 73 4B 16 F6
|
||
|
00F0 | 52 CE DB 42 93 CB B7 C8 78 A3 A3 FF AC 9D BE A9
|
||
|
0100 | DF 7C 67 BC 9E 95 08 E1 11 C7 8F C4 6E 05 7F 5C
|
||
|
0110 | 65 AD E3 81 D9 1F EE 43 0A 6B 57 6A 99 BD F8 55
|
||
|
0120 | 1F DB 1B E2 B5 70 69 B1 A4 57 30 61 8F 27 42 7E
|
||
|
0130 | 8A 04 72 0B 49 71 EF 4A 92 15 98 3D 68 F2 83 0C
|
||
|
0140 | 3E AA 6E 40 38 55 62 F9 70 D3 8A 05 C9 F1 24 6D
|
||
|
0150 | C3 34 38 E6</code></pre>
|
||
|
<h4><a class="anchor" href="#5-a-response-from-the-server-has-been-received-with-the-following-content" id="5-a-response-from-the-server-has-been-received-with-the-following-content" name="5-a-response-from-the-server-has-been-received-with-the-following-content"><i class="anchor-icon"></i></a>5. A response from the server has been received with the following content:</h4>
|
||
|
<pre><code>0000 | 00 00 00 00 00 00 00 00 01 54 43 36 CB 7A E5 51
|
||
|
0010 | 78 02 00 00 5C 07 E8 D0 3E 05 49 82 8C CA 27 E9
|
||
|
0020 | 66 B3 01 A4 8F EC E2 FC A5 CF 4D 33 F4 A1 1E A8
|
||
|
0030 | 77 BA 4A A5 73 90 73 30 FE 50 02 00 28 A9 2F E2
|
||
|
0040 | 01 73 B3 47 A8 BB 32 4B 5F AB 26 67 C9 A8 BB CE
|
||
|
0050 | 64 68 D5 B5 09 A4 CB DD C1 86 24 0A C9 12 CF 70
|
||
|
0060 | 06 AF 89 26 DE 60 6A 2E 74 C0 49 3C AA 57 74 1E
|
||
|
0070 | 6C 82 45 1F 54 D3 E0 68 F5 CC C4 9B 44 44 12 4B
|
||
|
0080 | 96 66 FF B4 05 AA B5 64 A3 D0 1E 67 F6 E9 12 86
|
||
|
0090 | 7C 8D 20 D9 88 27 07 DC 33 0B 17 B4 E0 DD 57 CB
|
||
|
00A0 | 53 BF AA FA 9E F5 BE 76 AE 6C 1B 9B 6C 51 E2 D6
|
||
|
00B0 | 50 2A 47 C8 83 09 5C 46 C8 1E 3B E2 5F 62 42 7B
|
||
|
00C0 | 58 54 88 BB 3B F2 39 21 3B F4 8E B8 FE 34 C9 A0
|
||
|
00D0 | 26 CC 84 13 93 40 43 97 4D B0 35 56 63 30 38 39
|
||
|
00E0 | 2C EC B5 1F 94 82 4E 14 0B 98 63 77 30 A4 BE 79
|
||
|
00F0 | A8 F9 DA FA 39 BA E8 1E 10 95 84 9E A4 C8 34 67
|
||
|
0100 | C9 2A 3A 17 D9 97 81 7C 8A 7A C6 1C 3F F4 14 DA
|
||
|
0110 | 37 B7 D6 6E 94 9C 0A EC 85 8F 04 82 24 21 0F CC
|
||
|
0120 | 61 F1 1C 3A 91 0B 43 1C CB D1 04 CC CC 8D C6 D2
|
||
|
0130 | 9D 4A 5D 13 3B E6 39 A4 C3 2B BF F1 53 E6 3A CA
|
||
|
0140 | 3A C5 2F 2E 47 09 B8 AE 01 84 4B 14 2C 1E E8 9D
|
||
|
0150 | 07 5D 64 F6 9A 39 9F EB 04 E6 56 FE 36 75 A6 F8
|
||
|
0160 | F4 12 07 8F 3D 0B 58 DA 15 31 1C 1A 9F 8E 53 B3
|
||
|
0170 | CD 6B B5 57 2C 29 49 04 B7 26 D0 BE 33 7E 2E 21
|
||
|
0180 | 97 7D A2 6D D6 E3 32 70 25 1C 2C A2 9D FC C7 02
|
||
|
0190 | 27 F0 75 5F 84 CF DA 9A C4 B8 DD 5F 84 F1 D1 EB
|
||
|
01A0 | 36 BA 45 CD DC 70 44 4D 8C 21 3E 4B D8 F6 3B 8A
|
||
|
01B0 | B9 5A 2D 0B 41 80 DC 91 28 3D C0 63 AC FB 92 D6
|
||
|
01C0 | A4 E4 07 CD E7 C8 C6 96 89 F7 7A 00 74 41 D4 A6
|
||
|
01D0 | A8 38 4B 66 65 02 D9 B7 7F C6 8B 5B 43 CC 60 7E
|
||
|
01E0 | 60 A1 46 22 3E 11 0F CB 43 BC 3C 94 2E F9 81 93
|
||
|
01F0 | 0C DC 4A 1D 31 0C 0B 64 D5 E5 5D 30 8D 86 32 51
|
||
|
0200 | AB 90 50 2C 3E 46 CC 59 9E 88 6A 92 7C DA 96 3B
|
||
|
0210 | 9E B1 6C E6 26 03 B6 85 29 EE 98 F9 F5 20 64 19
|
||
|
0220 | E0 3F B4 58 EC 4B D9 45 4A A8 F6 BA 77 75 73 CC
|
||
|
0230 | 54 B3 28 89 5B 1D F2 5E AD 9F B4 CD 51 98 EE 02
|
||
|
0240 | 2B 2B 81 F3 88 D2 81 D5 E5 BC 58 01 07 CA 01 A5
|
||
|
0250 | 06 65 C3 2B 55 27 15 F3 35 FD 76 26 4F AD 00 DD
|
||
|
0260 | D5 AE 45 B9 48 32 AC 79 CE 7C 51 1D 19 4B C4 2B
|
||
|
0270 | 70 EF A8 50 BB 15 C2 01 2C 52 15 CA BF E9 7C E6
|
||
|
0280 | 6B 8D 87 34 D0 EE 75 9A 63 8A F0 13</code></pre>
|
||
|
<h5><a class="anchor" href="#response-decomposition-using-the-following-formula" id="response-decomposition-using-the-following-formula" name="response-decomposition-using-the-following-formula"><i class="anchor-icon"></i></a>Response decomposition using the following formula:</h5>
|
||
|
<pre><code>server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params;
|
||
|
server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:string = Server_DH_Params;</code></pre>
|
||
|
<table class="table">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>Parameter</th>
|
||
|
<th>Offset, Length in bytes</th>
|
||
|
<th>Value</th>
|
||
|
<th>Description</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>auth_key_id</td>
|
||
|
<td>0, 8</td>
|
||
|
<td><code>0</code></td>
|
||
|
<td>Since message is in plain text</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>message_id</td>
|
||
|
<td>8, 8</td>
|
||
|
<td><code>51E57ACB36435401</code></td>
|
||
|
<td>Exact unixtime * 2^32</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>message_length</td>
|
||
|
<td>16, 4</td>
|
||
|
<td><code>632</code></td>
|
||
|
<td>Message body length</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>%(server_DH_params_ok)</td>
|
||
|
<td>20, 4</td>
|
||
|
<td><code>d0e8075c</code></td>
|
||
|
<td>server_DH_params_ok constructor number from TL schema</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>nonce</td>
|
||
|
<td>24, 16</td>
|
||
|
<td><code>3E0549828CCA27E966B301A48FECE2FC</code></td>
|
||
|
<td>Value generated by client in Step 1</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>server_nonce</td>
|
||
|
<td>40, 16</td>
|
||
|
<td><code>A5CF4D33F4A11EA877BA4AA573907330</code></td>
|
||
|
<td>Value received from server in Step 2</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>encrypted_answer</td>
|
||
|
<td>56, 596</td>
|
||
|
<td>See below</td>
|
||
|
<td>See <a href="#conversion-of-encrypted_answer-into-answer">“Decomposition of encrypted_answer"</a></td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
<h5><a class="anchor" href="#conversion-of-encrypted-answer-into-answer" id="conversion-of-encrypted-answer-into-answer" name="conversion-of-encrypted-answer-into-answer"><i class="anchor-icon"></i></a>Conversion of encrypted_answer into <strong>answer</strong>:</h5>
|
||
|
<pre><code>encrypted_answer = 28A92FE20173B347A8BB324B5FAB2667C9A8BBCE6468D5B509A4CBDDC186240AC912CF7006AF8926DE606A2E74C0493CAA57741E6C82451F54D3E068F5CCC49B4444124B9666FFB405AAB564A3D01E67F6E912867C8D20D9882707DC330B17B4E0DD57CB53BFAAFA9EF5BE76AE6C1B9B6C51E2D6502A47C883095C46C81E3BE25F62427B585488BB3BF239213BF48EB8FE34C9A026CC8413934043974DB03556633038392CECB51F94824E140B98637730A4BE79A8F9DAFA39BAE81E1095849EA4C83467C92A3A17D997817C8A7AC61C3FF414DA37B7D66E949C0AEC858F048224210FCC61F11C3A910B431CCBD104CCCC8DC6D29D4A5D133BE639A4C32BBFF153E63ACA3AC52F2E4709B8AE01844B142C1EE89D075D64F69A399FEB04E656FE3675A6F8F412078F3D0B58DA15311C1A9F8E53B3CD6BB5572C294904B726D0BE337E2E21977DA26DD6E33270251C2CA29DFCC70227F0755F84CFDA9AC4B8DD5F84F1D1EB36BA45CDDC70444D8C213E4BD8F63B8AB95A2D0B4180DC91283DC063ACFB92D6A4E407CDE7C8C69689F77A007441D4A6A8384B666502D9B77FC68B5B43CC607E60A146223E110FCB43BC3C942EF981930CDC4A1D310C0B64D5E55D308D863251AB90502C3E46CC599E886A927CDA963B9EB16CE62603B68529EE98F9F5206419E03FB458EC4BD9454AA8F6BA777573CC54B328895B1DF25EAD9FB4CD5198EE022B2B81F388D281D5E5BC580107CA01A50665C32B552715F335FD76264FAD00DDD5AE45B94832AC79CE7C511D194BC42B70EFA850BB15C2012C5215CABFE97CE66B8D8734D0EE759A638AF013
|
||
|
tmp_aes_key = F011280887C7BB01DF0FC4E17830E0B91FBB8BE4B2267CB985AE25F33B527253
|
||
|
tmp_aes_iv = 3212D579EE35452ED23E0D0C92841AA7D31B2E9BDEF2151E80D15860311C85DB
|
||
|
answer = BA0D89B53E0549828CCA27E966B301A48FECE2FCA5CF4D33F4A11EA877BA4AA57390733002000000FE000100C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5BFE000100262AABA621CC4DF587DC94CF8252258C0B9337DFB47545A49CDD5C9B8EAE7236C6CADC40B24E88590F1CC2CC762EBF1CF11DCC0B393CAAD6CEE4EE5848001C73ACBB1D127E4CB93072AA3D1C8151B6FB6AA6124B7CD782EAF981BDCFCE9D7A00E423BD9D194E8AF78EF6501F415522E44522281C79D906DDB79C72E9C63D83FB2A940FF779DFB5F2FD786FB4AD71C9F08CF48758E534E9815F634F1E3A80A5E1C2AF210C5AB762755AD4B2126DFA61A77FA9DA967D65DFD0AFB5CDF26C4D4E1A88B180F4E0D0B45BA1484F95CB2712B50BF3F5968D9D55C99C0FB9FB67BFF56D7D4481B634514FBA3488C4CDA2FC0659990E8E868B28632875A9AA703BCDCE8FCB7AE551</code></pre>
|
||
|
<h5><a class="anchor" href="#server-dh-inner-data-decomposition-using-the-following-formula" id="server-dh-inner-data-decomposition-using-the-following-formula" name="server-dh-inner-data-decomposition-using-the-following-formula"><i class="anchor-icon"></i></a>Server_DH_inner_data decomposition using the following formula:</h5>
|
||
|
<pre><code>server_DH_inner_data#b5890dba nonce:int128 server_nonce:int128 g:int dh_prime:string g_a:string server_time:int = Server_DH_inner_data;</code></pre>
|
||
|
<table class="table">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>Parameter</th>
|
||
|
<th>Offset, Length in bytes</th>
|
||
|
<th>Value</th>
|
||
|
<th>Description</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>%(server_DH_inner_data)</td>
|
||
|
<td>0, 4</td>
|
||
|
<td><code>b5890dba</code></td>
|
||
|
<td>server_DH_inner_data constructor number from TL schema</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>nonce</td>
|
||
|
<td>4, 16</td>
|
||
|
<td><code>3E0549828CCA27E966B301A48FECE2FC</code></td>
|
||
|
<td>Value generated by client in Step 1</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>server_nonce</td>
|
||
|
<td>20, 16</td>
|
||
|
<td><code>A5CF4D33F4A11EA877BA4AA573907330</code></td>
|
||
|
<td>Value received from server in Step 2</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>g</td>
|
||
|
<td>36, 4</td>
|
||
|
<td><code>2</code></td>
|
||
|
<td>Value received from server in Step 2</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>dh_prime</td>
|
||
|
<td>40, 260</td>
|
||
|
<td><code>C71CAEB9C6B1C9048E6C522F70F13F73</code> <code>980D40238E3E21C14934D037563D930F</code> <code>48198A0AA7C14058229493D22530F4DB</code> <code>FA336F6E0AC925139543AED44CCE7C37</code> <code>20FD51F69458705AC68CD4FE6B6B13AB</code> <code>DC9746512969328454F18FAF8C595F64</code> <code>2477FE96BB2A941D5BCD1D4AC8CC4988</code> <code>0708FA9B378E3C4F3A9060BEE67CF9A4</code> <code>A4A695811051907E162753B56B0F6B41</code> <code>0DBA74D8A84B2A14B3144E0EF1284754</code> <code>FD17ED950D5965B4B9DD46582DB1178D</code> <code>169C6BC465B0D6FF9CA3928FEF5B9AE4</code> <code>E418FC15E83EBEA0F87FA9FF5EED7005</code> <code>0DED2849F47BF959D956850CE929851F</code> <code>0D8115F635B105EE2E4E15D04B2454BF</code> <code>6F4FADF034B10403119CD8E3B92FCC5B</code></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>g_a</td>
|
||
|
<td>300, 260</td>
|
||
|
<td><code>262AABA621CC4DF587DC94CF8252258C</code> <code>0B9337DFB47545A49CDD5C9B8EAE7236</code> <code>C6CADC40B24E88590F1CC2CC762EBF1C</code> <code>F11DCC0B393CAAD6CEE4EE5848001C73</code> <code>ACBB1D127E4CB93072AA3D1C8151B6FB</code> <code>6AA6124B7CD782EAF981BDCFCE9D7A00</code> <code>E423BD9D194E8AF78EF6501F415522E4</code> <code>4522281C79D906DDB79C72E9C63D83FB</code> <code>2A940FF779DFB5F2FD786FB4AD71C9F0</code> <code>8CF48758E534E9815F634F1E3A80A5E1</code> <code>C2AF210C5AB762755AD4B2126DFA61A7</code> <code>7FA9DA967D65DFD0AFB5CDF26C4D4E1A</code> <code>88B180F4E0D0B45BA1484F95CB2712B5</code> <code>0BF3F5968D9D55C99C0FB9FB67BFF56D</code> <code>7D4481B634514FBA3488C4CDA2FC0659</code> <code>990E8E868B28632875A9AA703BCDCE8F</code></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>server_time</td>
|
||
|
<td>560, 4</td>
|
||
|
<td><code>1373993675</code></td>
|
||
|
<td>Server time</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
<h4><a class="anchor" href="#6-random-number-b-is-computed" id="6-random-number-b-is-computed" name="6-random-number-b-is-computed"><i class="anchor-icon"></i></a>6. Random number b is computed:</h4>
|
||
|
<pre><code>b = 6F620AFA575C9233EB4C014110A7BCAF49464F798A18A0981FEA1E05E8DA67D9681E0FD6DF0EDF0272AE3492451A84502F2EFC0DA18741A5FB80BD82296919A70FAA6D07CBBBCA2037EA7D3E327B61D585ED3373EE0553A91CBD29B01FA9A89D479CA53D57BDE3A76FBD922A923A0A38B922C1D0701F53FF52D7EA9217080163A64901E766EB6A0F20BC391B64B9D1DD2CD13A7D0C946A3A7DF8CEC9E2236446F646C42CFE2B60A2A8D776E56C8D7519B08B88ED0970E10D12A8C9E355D765F2B7BBB7B4CA9360083435523CB0D57D2B106FD14F94B4EEE79D8AC131CA56AD389C84FE279716F8124A543337FB9EA3D988EC5FA63D90A4BA3970E7A39E5C0DE5</code></pre>
|
||
|
<h5><a class="anchor" href="#generation-of-encrypted-data" id="generation-of-encrypted-data" name="generation-of-encrypted-data"><i class="anchor-icon"></i></a>Generation of encrypted_data</h5>
|
||
|
<pre><code>client_DH_inner_data#6643b654 nonce:int128 server_nonce:int128 retry_id:long g_b:string = Client_DH_Inner_Data</code></pre>
|
||
|
<table class="table">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>Parameter</th>
|
||
|
<th>Offset, Length in bytes</th>
|
||
|
<th>Value</th>
|
||
|
<th>Description</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>%(client_DH_inner_data)</td>
|
||
|
<td>0, 4</td>
|
||
|
<td><code>6643b654</code></td>
|
||
|
<td>client_DH_inner_data constructor number from TL schema</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>nonce</td>
|
||
|
<td>4, 16</td>
|
||
|
<td><code>3E0549828CCA27E966B301A48FECE2FC</code></td>
|
||
|
<td>Value generated by client in Step 1</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>server_nonce</td>
|
||
|
<td>20, 16</td>
|
||
|
<td><code>A5CF4D33F4A11EA877BA4AA573907330</code></td>
|
||
|
<td>Value received from server in Step 2</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>retry_id</td>
|
||
|
<td>36, 8</td>
|
||
|
<td><code>0</code></td>
|
||
|
<td>First attempt</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>g_b</td>
|
||
|
<td>44, 260</td>
|
||
|
<td><code>73700E7BFC7AEEC828EB8E0DCC04D09A</code> <code>0DD56A1B4B35F72F0B55FCE7DB7EBB72</code> <code>D7C33C5D4AA59E1C74D09B01AE536B31</code> <code>8CFED436AFDB15FE9EB4C70D7F0CB14E</code> <code>46DBBDE9053A64304361EB358A9BB32E</code> <code>9D5C2843FE87248B89C3F066A7D5876D</code> <code>61657ACC52B0D81CD683B2A0FA93E8AD</code> <code>AB20377877F3BC3369BBF57B10F5B589</code> <code>E65A9C27490F30A0C70FFCFD3453F5B3</code> <code>79C1B9727A573CFFDCA8D23C721B135B</code> <code>92E529B1CDD2F7ABD4F34DAC4BE1EEAF</code> <code>60993DDE8ED45890E4F47C26F2C0B2E0</code> <code>37BB502739C8824F2A99E2B1E7E41658</code> <code>3417CC79A8807A4BDAC6A5E9805D4F61</code> <code>86C37D66F6988C9F9C752896F3D34D25</code> <code>529263FAF2670A09B2A59CE35264511F</code></td>
|
||
|
<td><code>g^b mod dh_prime</code></td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
<p>The serialization of <em>Client_DH_Inner_Data</em> produces some string <strong>data</strong>. This is followed by <strong>encrypted_data</strong>:</p>
|
||
|
<pre><code>data_with_hash := SHA1(data) + data + (0-15 random bytes); such that the length be divisible by 16;
|
||
|
AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv) = 928A4957D0463B525C1CC48AABAA030A256BE5C746792C84CA4C5A0DF60AC799048D98A38A8480EDCF082214DFC79DCB9EE34E206513E2B3BC1504CFE6C9ADA46BF9A03CA74F192EAF8C278454ADABC795A566615462D31817382984039505F71CB33A41E2527A4B1AC05107872FED8E3ABCEE1518AE965B0ED3AED7F67479155BDA8E4C286B64CDF123EC748CF289B1DB02D1907B562DF462D8582BA6F0A3022DC2D3504D69D1BA48B677E3A830BFAFD67584C8AA24E1344A8904E305F9587C92EF964F0083F50F61EAB4A393EAA33C9270294AEDC7732891D4EA1599F52311D74469D2112F4EDF3F342E93C8E87E812DC3989BAECFE6740A46077524C75093F5A5405736DE8937BB6E42C9A0DCF22CA53227D462BCCC2CFE94B6FE86AB7FBFA395021F66661AF7C0024CA2986CA03F3476905407D1EA9C010B763258DB1AA2CC7826D91334EFC1FDC665B67FE45ED0</code></pre>
|
||
|
<p>The length of the final string was 336 bytes.</p>
|
||
|
<h5><a class="anchor" href="#request" id="request" name="request"><i class="anchor-icon"></i></a>Request</h5>
|
||
|
<pre><code>set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:string = Set_client_DH_params_answer;</code></pre>
|
||
|
<table class="table">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>Parameter</th>
|
||
|
<th>Offset, Length in bytes</th>
|
||
|
<th>Value</th>
|
||
|
<th>Description</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>auth_key_id</td>
|
||
|
<td>0, 8</td>
|
||
|
<td><code>0</code></td>
|
||
|
<td>Since message is in plain text</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>message_id</td>
|
||
|
<td>8, 8</td>
|
||
|
<td><code>51e57acd2aa32c6d</code></td>
|
||
|
<td>Exact unixtime * 2^32</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>message_length</td>
|
||
|
<td>16, 4</td>
|
||
|
<td><code>376</code></td>
|
||
|
<td>Message body length</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>%(set_client_DH_params)</td>
|
||
|
<td>20, 4</td>
|
||
|
<td><code>f5045f1f</code></td>
|
||
|
<td>set_client_DH_params constructor number from TL schema</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>nonce</td>
|
||
|
<td>24, 16</td>
|
||
|
<td><code>3E0549828CCA27E966B301A48FECE2FC</code></td>
|
||
|
<td>Value generated by client in Step 1</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>server_nonce</td>
|
||
|
<td>40, 16</td>
|
||
|
<td><code>A5CF4D33F4A11EA877BA4AA573907330</code></td>
|
||
|
<td>Value received from server in Step 2</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>encrypted_data</td>
|
||
|
<td>56, 340</td>
|
||
|
<td>See above</td>
|
||
|
<td>See <a href="#generatsiya-encrypted-data">“Generation of encrypted_data"</a></td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
<pre><code>0000 | 00 00 00 00 00 00 00 00 6D 2C A3 2A CD 7A E5 51
|
||
|
0010 | 78 01 00 00 1F 5F 04 F5 3E 05 49 82 8C CA 27 E9
|
||
|
0020 | 66 B3 01 A4 8F EC E2 FC A5 CF 4D 33 F4 A1 1E A8
|
||
|
0030 | 77 BA 4A A5 73 90 73 30 FE 50 01 00 92 8A 49 57
|
||
|
0040 | D0 46 3B 52 5C 1C C4 8A AB AA 03 0A 25 6B E5 C7
|
||
|
0050 | 46 79 2C 84 CA 4C 5A 0D F6 0A C7 99 04 8D 98 A3
|
||
|
0060 | 8A 84 80 ED CF 08 22 14 DF C7 9D CB 9E E3 4E 20
|
||
|
0070 | 65 13 E2 B3 BC 15 04 CF E6 C9 AD A4 6B F9 A0 3C
|
||
|
0080 | A7 4F 19 2E AF 8C 27 84 54 AD AB C7 95 A5 66 61
|
||
|
0090 | 54 62 D3 18 17 38 29 84 03 95 05 F7 1C B3 3A 41
|
||
|
00A0 | E2 52 7A 4B 1A C0 51 07 87 2F ED 8E 3A BC EE 15
|
||
|
00B0 | 18 AE 96 5B 0E D3 AE D7 F6 74 79 15 5B DA 8E 4C
|
||
|
00C0 | 28 6B 64 CD F1 23 EC 74 8C F2 89 B1 DB 02 D1 90
|
||
|
00D0 | 7B 56 2D F4 62 D8 58 2B A6 F0 A3 02 2D C2 D3 50
|
||
|
00E0 | 4D 69 D1 BA 48 B6 77 E3 A8 30 BF AF D6 75 84 C8
|
||
|
00F0 | AA 24 E1 34 4A 89 04 E3 05 F9 58 7C 92 EF 96 4F
|
||
|
0100 | 00 83 F5 0F 61 EA B4 A3 93 EA A3 3C 92 70 29 4A
|
||
|
0110 | ED C7 73 28 91 D4 EA 15 99 F5 23 11 D7 44 69 D2
|
||
|
0120 | 11 2F 4E DF 3F 34 2E 93 C8 E8 7E 81 2D C3 98 9B
|
||
|
0130 | AE CF E6 74 0A 46 07 75 24 C7 50 93 F5 A5 40 57
|
||
|
0140 | 36 DE 89 37 BB 6E 42 C9 A0 DC F2 2C A5 32 27 D4
|
||
|
0150 | 62 BC CC 2C FE 94 B6 FE 86 AB 7F BF A3 95 02 1F
|
||
|
0160 | 66 66 1A F7 C0 02 4C A2 98 6C A0 3F 34 76 90 54
|
||
|
0170 | 07 D1 EA 9C 01 0B 76 32 58 DB 1A A2 CC 78 26 D9
|
||
|
0180 | 13 34 EF C1 FD C6 65 B6 7F E4 5E D0</code></pre>
|
||
|
<h4><a class="anchor" href="#7-computing-auth-key-using-formula-gab-mod-dh-prime" id="7-computing-auth-key-using-formula-gab-mod-dh-prime" name="7-computing-auth-key-using-formula-gab-mod-dh-prime"><i class="anchor-icon"></i></a>7. Computing auth_key using formula <code>g^{ab} mod dh_prime</code>:</h4>
|
||
|
<pre><code>auth_key = AB96E207C631300986F30EF97DF55E179E63C112675F0CE502EE76D74BBEE6CBD1E95772818881E9F2FF54BD52C258787474F6A7BEA61EABE49D1D01D55F64FC07BC31685716EC8FB46FEACF9502E42CFD6B9F45A08E90AA5C2B5933AC767CBE1CD50D8E64F89727CA4A1A5D32C0DB80A9FCDBDDD4F8D5A1E774198F1A4299F927C484FEEC395F29647E43C3243986F93609E23538C21871DF50E00070B3B6A8FA9BC15628E8B43FF977409A61CEEC5A21CF7DFB5A4CC28F5257BC30CD8F2FB92FBF21E28924065F50E0BBD5E11A420300E2C136B80E9826C6C5609B5371B7850AA628323B6422F3A94F6DFDE4C3DC1EA60F7E11EE63122B3F39CBD1A8430157</code></pre>
|
||
|
<h4><a class="anchor" href="#8-the-server-verifies-that-auth-key-hash-is-unique" id="8-the-server-verifies-that-auth-key-hash-is-unique" name="8-the-server-verifies-that-auth-key-hash-is-unique"><i class="anchor-icon"></i></a>8. The server verifies that auth_key_hash is unique.</h4>
|
||
|
<p>The key is unique.</p>
|
||
|
<h4><a class="anchor" href="#9-a-response-from-the-server-has-been-received-with-the-following-content" id="9-a-response-from-the-server-has-been-received-with-the-following-content" name="9-a-response-from-the-server-has-been-received-with-the-following-content"><i class="anchor-icon"></i></a>9. A response from the server has been received with the following content:</h4>
|
||
|
<pre><code>0000 | 00 00 00 00 00 00 00 00 01 30 AA C5 CE 7A E5 51
|
||
|
0010 | 34 00 00 00 34 F7 CB 3B 3E 05 49 82 8C CA 27 E9
|
||
|
0020 | 66 B3 01 A4 8F EC E2 FC A5 CF 4D 33 F4 A1 1E A8
|
||
|
0030 | 77 BA 4A A5 73 90 73 30 CC EB C0 21 72 66 E1 ED
|
||
|
0040 | EC 7F B0 A0 EE D6 C2 20</code></pre>
|
||
|
<p>Set_client_DH_params_answer decomposition using the following formula:</p>
|
||
|
<pre><code>dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer;
|
||
|
dh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer;
|
||
|
dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer;</code></pre>
|
||
|
<table class="table">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>Parameter</th>
|
||
|
<th>Offset, Length in bytes</th>
|
||
|
<th>Value</th>
|
||
|
<th>Description</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>%(dh_gen_ok)</td>
|
||
|
<td>0, 4</td>
|
||
|
<td><code>3bcbf734</code></td>
|
||
|
<td>dh_gen_ok constructor number from TL schema</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>nonce</td>
|
||
|
<td>4, 16</td>
|
||
|
<td><code>3E0549828CCA27E966B301A48FECE2FC</code></td>
|
||
|
<td>Value generated by client in Step 1</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>server_nonce</td>
|
||
|
<td>20, 16</td>
|
||
|
<td><code>A5CF4D33F4A11EA877BA4AA573907330</code></td>
|
||
|
<td>Value received from server in Step 2</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>new_nonce_hash1</td>
|
||
|
<td>36, 16</td>
|
||
|
<td><code>CCEBC0217266E1EDEC7FB0A0EED6C220</code></td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table></div>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="footer_wrap">
|
||
|
<div class="footer_columns_wrap footer_desktop">
|
||
|
<div class="footer_column footer_column_telegram">
|
||
|
<h5>Telegram</h5>
|
||
|
<div class="footer_telegram_description"></div>
|
||
|
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
|
||
|
</div>
|
||
|
|
||
|
<div class="footer_column">
|
||
|
<h5><a href="//telegram.org/faq">About</a></h5>
|
||
|
<ul>
|
||
|
<li><a href="//telegram.org/faq">FAQ</a></li>
|
||
|
<li><a href="//telegram.org/blog">Blog</a></li>
|
||
|
<li><a href="//telegram.org/jobs">Jobs</a></li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<div class="footer_column">
|
||
|
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
|
||
|
<ul>
|
||
|
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
|
||
|
<li><a href="//telegram.org/dl/android">Android</a></li>
|
||
|
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<div class="footer_column">
|
||
|
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
|
||
|
<ul>
|
||
|
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
|
||
|
<li><a href="//macos.telegram.org/">macOS</a></li>
|
||
|
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<div class="footer_column footer_column_platform">
|
||
|
<h5><a href="/">Platform</a></h5>
|
||
|
<ul>
|
||
|
<li><a href="/api">API</a></li>
|
||
|
<li><a href="//translations.telegram.org/">Translations</a></li>
|
||
|
<li><a href="//instantview.telegram.org/">Instant View</a></li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="footer_columns_wrap footer_mobile">
|
||
|
<div class="footer_column">
|
||
|
<h5><a href="//telegram.org/faq">About</a></h5>
|
||
|
</div>
|
||
|
<div class="footer_column">
|
||
|
<h5><a href="//telegram.org/blog">Blog</a></h5>
|
||
|
</div>
|
||
|
<div class="footer_column">
|
||
|
<h5><a href="//telegram.org/apps">Apps</a></h5>
|
||
|
</div>
|
||
|
<div class="footer_column">
|
||
|
<h5><a href="/">Platform</a></h5>
|
||
|
</div>
|
||
|
<div class="footer_column">
|
||
|
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<script src="/js/main.js?46"></script>
|
||
|
|
||
|
<script>backToTopInit("Go up");
|
||
|
removePreloadInit();
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|
||
|
|