Tag datastructure definitions in docs/transport/* for highlighting

This commit is contained in:
str4d
2013-06-10 07:47:26 +00:00
parent 101bfae7d8
commit 315f00d1e4
2 changed files with 41 additions and 43 deletions

View File

@@ -34,11 +34,11 @@ After establishment,
the NTCP transport sends individual I2NP messages, with a simple checksum. the NTCP transport sends individual I2NP messages, with a simple checksum.
The unencrypted message is encoded as follows: The unencrypted message is encoded as follows:
{%- endtrans %}</p> {%- endtrans %}</p>
<pre> {% highlight %}
* +-------+-------+--//--+---//----+-------+-------+-------+-------+ +-------+-------+--//--+---//----+-------+-------+-------+-------+
* | sizeof(data) | data | padding | Adler checksum of sz+data+pad | | sizeof(data) | data | padding | Adler checksum of sz+data+pad |
* +-------+-------+--//--+---//----+-------+-------+-------+-------+ +-------+-------+--//--+---//----+-------+-------+-------+-------+
</pre> {% endhighlight %}
<p>{% trans -%} <p>{% trans -%}
The data is then AES/256/CBC encrypted. The session key for the encryption The data is then AES/256/CBC encrypted. The session key for the encryption
is negotiated during establishment (using Diffie-Hellman 2048 bit). is negotiated during establishment (using Diffie-Hellman 2048 bit).
@@ -60,13 +60,13 @@ The minimum data size is 1.
One special case is a metadata message where the sizeof(data) is 0. In One special case is a metadata message where the sizeof(data) is 0. In
that case, the unencrypted message is encoded as: that case, the unencrypted message is encoded as:
{%- endtrans %}</p> {%- endtrans %}</p>
<pre> {% highlight %}
* +-------+-------+-------+-------+-------+-------+-------+-------+ +-------+-------+-------+-------+-------+-------+-------+-------+
* | 0 | timestamp in seconds | uninterpreted | 0 | timestamp in seconds | uninterpreted
* +-------+-------+-------+-------+-------+-------+-------+-------+ +-------+-------+-------+-------+-------+-------+-------+-------+
* uninterpreted | Adler checksum of bytes 0-11 | uninterpreted | Adler checksum of bytes 0-11 |
* +-------+-------+-------+-------+-------+-------+-------+-------+ +-------+-------+-------+-------+-------+-------+-------+-------+
</pre> {% endhighlight %}
<p>{% trans -%} <p>{% trans -%}
Total length: 16 bytes. The time sync message is sent at approximately 15 minute intervals. Total length: 16 bytes. The time sync message is sent at approximately 15 minute intervals.
The message is encrypted just as standard messages are. The message is encrypted just as standard messages are.
@@ -86,17 +86,15 @@ In the establish state, there is a 4-phase message sequence to exchange DH keys
In the first two messages there is a 2048-bit Diffie Hellman exchange. In the first two messages there is a 2048-bit Diffie Hellman exchange.
Then, DSA signatures of the critical data are exchanged to confirm the connection. Then, DSA signatures of the critical data are exchanged to confirm the connection.
{%- endtrans %}</p> {%- endtrans %}</p>
<pre> {% highlight %}
* Alice contacts Bob Alice contacts Bob
* ========================================================= =========================================================
* X+(H(X) xor Bob.identHash)-----------------------------&gt; X+(H(X) xor Bob.identHash)-----------------------------&gt;
* &lt;----------------------------------------Y+E(H(X+Y)+tsB+padding, sk, Y[239:255]) &lt;----------------------------------------Y+E(H(X+Y)+tsB+padding, sk, Y[239:255])
* E(sz+Alice.identity+tsA+padding+S(X+Y+Bob.identHash+tsA+tsB), sk, hX_xor_Bob.identHash[16:31])---&gt; E(sz+Alice.identity+tsA+padding+S(X+Y+Bob.identHash+tsA+tsB), sk, hX_xor_Bob.identHash[16:31])---&gt;
* &lt;----------------------E(S(X+Y+Alice.identHash+tsA+tsB)+padding, sk, prev) &lt;----------------------E(S(X+Y+Alice.identHash+tsA+tsB)+padding, sk, prev)
</pre>
<pre>
{% trans %}Legend:{% endtrans %} {% trans %}Legend:{% endtrans %}
X, Y: {% trans %}256 byte DH public keys{% endtrans %} X, Y: {% trans %}256 byte DH public keys{% endtrans %}
H(): 32 byte SHA256 Hash H(): 32 byte SHA256 Hash
@@ -105,7 +103,7 @@ Then, DSA signatures of the critical data are exchanged to confirm the connectio
tsA, tsB: {% trans %}timestamps (4 bytes, seconds since epoch){% endtrans %} tsA, tsB: {% trans %}timestamps (4 bytes, seconds since epoch){% endtrans %}
sk: {% trans %}32 byte Session key{% endtrans %} sk: {% trans %}32 byte Session key{% endtrans %}
sz: {% trans %}2 byte size of Alice identity to follow{% endtrans %} sz: {% trans %}2 byte size of Alice identity to follow{% endtrans %}
</pre> {% endhighlight %}
<h4 id="DH">{% trans %}DH Key Exchange{% endtrans %}</h4> <h4 id="DH">{% trans %}DH Key Exchange{% endtrans %}</h4>
<p>{% trans cryptography=site_url('docs/how/cryptography') -%} <p>{% trans cryptography=site_url('docs/how/cryptography') -%}
@@ -143,11 +141,11 @@ which was published to the
<a href="{{ netdb }}">network database</a>. <a href="{{ netdb }}">network database</a>.
Alice sends Bob: Alice sends Bob:
{%- endtrans %}</p> {%- endtrans %}</p>
<pre> {% highlight %}
* X+(H(X) xor Bob.identHash)-----------------------------&gt; X+(H(X) xor Bob.identHash)-----------------------------&gt;
{% trans %}Size:{% endtrans %} 288 bytes {% trans %}Size:{% endtrans %} 288 bytes
</pre> {% endhighlight %}
<p>{% trans %}Contents:{% endtrans %}</p> <p>{% trans %}Contents:{% endtrans %}</p>
<pre> <pre>
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
@@ -186,13 +184,13 @@ Alice has contacted the wrong router, and Bob drops the connection.
<p>{% trans -%} <p>{% trans -%}
This is the DH reply. Bob sends Alice: This is the DH reply. Bob sends Alice:
{%- endtrans %}</p> {%- endtrans %}</p>
<pre> {% highlight %}
* &lt;----------------------------------------Y+E(H(X+Y)+tsB+padding, sk, Y[239:255]) &lt;----------------------------------------Y+E(H(X+Y)+tsB+padding, sk, Y[239:255])
{% trans %}Size:{% endtrans %} 304 bytes {% trans %}Size:{% endtrans %} 304 bytes
</pre> {% endhighlight %}
<p>{% trans %}Unencrypted Contents:{% endtrans %}</p> <p>{% trans %}Unencrypted Contents:{% endtrans %}</p>
<pre> {% highlight %}
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| Y as calculated from DH | | Y as calculated from DH |
+ + + +
@@ -222,7 +220,7 @@ This is the DH reply. Bob sends Alice:
padding: {% trans %}12 bytes random data{% endtrans %} padding: {% trans %}12 bytes random data{% endtrans %}
</pre> {% endhighlight %}
<p>{% trans %}Encrypted Contents:{% endtrans %}</p> <p>{% trans %}Encrypted Contents:{% endtrans %}</p>
@@ -266,11 +264,11 @@ Alice may drop the connection if the clock skew with Bob is too high as calculat
<p>{% trans -%} <p>{% trans -%}
This contains Alice's router identity, and a DSA signature of the critical data. Alice sends Bob: This contains Alice's router identity, and a DSA signature of the critical data. Alice sends Bob:
{%- endtrans %}</p> {%- endtrans %}</p>
<pre> {% highlight %}
* E(sz+Alice.identity+tsA+padding+S(X+Y+Bob.identHash+tsA+tsB), sk, hX_xor_Bob.identHash[16:31])---&gt; E(sz+Alice.identity+tsA+padding+S(X+Y+Bob.identHash+tsA+tsB), sk, hX_xor_Bob.identHash[16:31])---&gt;
{% trans %}Size:{% endtrans %} 448 bytes (typ. for 387 byte identity) {% trans %}Size:{% endtrans %} 448 bytes (typ. for 387 byte identity)
</pre> {% endhighlight %}
<p>{% trans %}Unencrypted Contents:{% endtrans %}</p> <p>{% trans %}Unencrypted Contents:{% endtrans %}</p>
<pre> <pre>
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
@@ -349,11 +347,11 @@ Bob may drop the connection if the clock skew with Alice is too high as calculat
<p>{% trans -%} <p>{% trans -%}
This is a DSA signature of the critical data. Bob sends Alice: This is a DSA signature of the critical data. Bob sends Alice:
{%- endtrans %}</p> {%- endtrans %}</p>
<pre> {% highlight %}
* &lt;----------------------E(S(X+Y+Alice.identHash+tsA+tsB)+padding, sk, prev) * &lt;----------------------E(S(X+Y+Alice.identHash+tsA+tsB)+padding, sk, prev)
{% trans %}Size:{% endtrans %} 48 bytes {% trans %}Size:{% endtrans %} 48 bytes
</pre> {% endhighlight %}
<p>{% trans %}Unencrypted Contents:{% endtrans %}</p> <p>{% trans %}Unencrypted Contents:{% endtrans %}</p>
<pre> <pre>
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+

View File

@@ -214,10 +214,10 @@ indirect address, for using a third party to introduce the peer.
There is no restriction on the number of addresses a peer may have. There is no restriction on the number of addresses a peer may have.
{%- endtrans %}</p> {%- endtrans %}</p>
<pre> {% highlight %}
Direct: host, port, introKey, options Direct: host, port, introKey, options
Indirect: tag, relayhost, port, relayIntroKey, targetIntroKey, options Indirect: tag, relayhost, port, relayIntroKey, targetIntroKey, options
</pre> {% endhighlight %}
<p>{% trans -%} <p>{% trans -%}
Each of the addresses may also expose a series of options - special Each of the addresses may also expose a series of options - special
@@ -240,7 +240,7 @@ The message sequence is as follows:
<p>{% trans -%} <p>{% trans -%}
Alice connects directly to Bob. Alice connects directly to Bob.
{%- endtrans %}</p> {%- endtrans %}</p>
<pre> {% highlight %}
Alice Bob Alice Bob
SessionRequest ---------------------&gt; SessionRequest ---------------------&gt;
&lt;--------------------- SessionCreated &lt;--------------------- SessionCreated
@@ -249,7 +249,7 @@ Alice connects directly to Bob.
&lt;--------------------- DatabaseStoreMessage &lt;--------------------- DatabaseStoreMessage
DatabaseStoreMessage ---------------&gt; DatabaseStoreMessage ---------------&gt;
Data &lt;---------------------------&gt; Data Data &lt;---------------------------&gt; Data
</pre> {% endhighlight %}
<p>{% trans i2npspec=site_url('docs/spec/i2np') -%} <p>{% trans i2npspec=site_url('docs/spec/i2np') -%}
After the SessionConfirmed message is received, Bob sends a small After the SessionConfirmed message is received, Bob sends a small
@@ -324,7 +324,7 @@ full direction session establishment with the specified IP and port.
Alice first connects to introducer Bob, who relays the request to Charlie. Alice first connects to introducer Bob, who relays the request to Charlie.
{%- endtrans %}</p> {%- endtrans %}</p>
<pre> {% highlight %}
Alice Bob Charlie Alice Bob Charlie
RelayRequest ----------------------&gt; RelayRequest ----------------------&gt;
&lt;-------------- RelayResponse RelayIntro -----------&gt; &lt;-------------- RelayResponse RelayIntro -----------&gt;
@@ -336,7 +336,7 @@ Alice first connects to introducer Bob, who relays the request to Charlie.
&lt;-------------------------------------------- DatabaseStoreMessage &lt;-------------------------------------------- DatabaseStoreMessage
DatabaseStoreMessage --------------------------------------&gt; DatabaseStoreMessage --------------------------------------&gt;
Data &lt;--------------------------------------------------&gt; Data Data &lt;--------------------------------------------------&gt; Data
</pre> {% endhighlight %}
<p>{% trans -%} <p>{% trans -%}
After the hole punch, the session is established between Alice and Charlie as in a direct establishment. After the hole punch, the session is established between Alice and Charlie as in a direct establishment.
@@ -359,7 +359,7 @@ and may update its behavior accordingly. The testing process is
quite simple: quite simple:
{%- endtrans %}</p> {%- endtrans %}</p>
<pre> {% highlight %}
Alice Bob Charlie Alice Bob Charlie
PeerTest -------------------&gt; PeerTest -------------------&gt;
PeerTest--------------------&gt; PeerTest--------------------&gt;
@@ -368,7 +368,7 @@ quite simple:
&lt;------------------------------------------PeerTest &lt;------------------------------------------PeerTest
PeerTest------------------------------------------&gt; PeerTest------------------------------------------&gt;
&lt;------------------------------------------PeerTest &lt;------------------------------------------PeerTest
</pre> {% endhighlight %}
<p>{% trans -%} <p>{% trans -%}
Each of the PeerTest messages carry a nonce identifying the Each of the PeerTest messages carry a nonce identifying the