Tag datastructure definitions in docs/transport/* for highlighting
This commit is contained in:
@@ -34,11 +34,11 @@ After establishment,
|
||||
the NTCP transport sends individual I2NP messages, with a simple checksum.
|
||||
The unencrypted message is encoded as follows:
|
||||
{%- endtrans %}</p>
|
||||
<pre>
|
||||
* +-------+-------+--//--+---//----+-------+-------+-------+-------+
|
||||
* | sizeof(data) | data | padding | Adler checksum of sz+data+pad |
|
||||
* +-------+-------+--//--+---//----+-------+-------+-------+-------+
|
||||
</pre>
|
||||
{% highlight %}
|
||||
+-------+-------+--//--+---//----+-------+-------+-------+-------+
|
||||
| sizeof(data) | data | padding | Adler checksum of sz+data+pad |
|
||||
+-------+-------+--//--+---//----+-------+-------+-------+-------+
|
||||
{% endhighlight %}
|
||||
<p>{% trans -%}
|
||||
The data is then AES/256/CBC encrypted. The session key for the encryption
|
||||
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
|
||||
that case, the unencrypted message is encoded as:
|
||||
{%- endtrans %}</p>
|
||||
<pre>
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
* | 0 | timestamp in seconds | uninterpreted
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
* uninterpreted | Adler checksum of bytes 0-11 |
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
</pre>
|
||||
{% highlight %}
|
||||
+-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
| 0 | timestamp in seconds | uninterpreted
|
||||
+-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
uninterpreted | Adler checksum of bytes 0-11 |
|
||||
+-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
{% endhighlight %}
|
||||
<p>{% trans -%}
|
||||
Total length: 16 bytes. The time sync message is sent at approximately 15 minute intervals.
|
||||
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.
|
||||
Then, DSA signatures of the critical data are exchanged to confirm the connection.
|
||||
{%- endtrans %}</p>
|
||||
<pre>
|
||||
* Alice contacts Bob
|
||||
* =========================================================
|
||||
* X+(H(X) xor Bob.identHash)----------------------------->
|
||||
* <----------------------------------------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])--->
|
||||
* <----------------------E(S(X+Y+Alice.identHash+tsA+tsB)+padding, sk, prev)
|
||||
{% highlight %}
|
||||
Alice contacts Bob
|
||||
=========================================================
|
||||
X+(H(X) xor Bob.identHash)----------------------------->
|
||||
<----------------------------------------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])--->
|
||||
<----------------------E(S(X+Y+Alice.identHash+tsA+tsB)+padding, sk, prev)
|
||||
|
||||
</pre>
|
||||
|
||||
<pre>
|
||||
{% trans %}Legend:{% endtrans %}
|
||||
X, Y: {% trans %}256 byte DH public keys{% endtrans %}
|
||||
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 %}
|
||||
sk: {% trans %}32 byte Session key{% endtrans %}
|
||||
sz: {% trans %}2 byte size of Alice identity to follow{% endtrans %}
|
||||
</pre>
|
||||
{% endhighlight %}
|
||||
|
||||
<h4 id="DH">{% trans %}DH Key Exchange{% endtrans %}</h4>
|
||||
<p>{% trans cryptography=site_url('docs/how/cryptography') -%}
|
||||
@@ -143,11 +141,11 @@ which was published to the
|
||||
<a href="{{ netdb }}">network database</a>.
|
||||
Alice sends Bob:
|
||||
{%- endtrans %}</p>
|
||||
<pre>
|
||||
* X+(H(X) xor Bob.identHash)----------------------------->
|
||||
{% highlight %}
|
||||
X+(H(X) xor Bob.identHash)----------------------------->
|
||||
|
||||
{% trans %}Size:{% endtrans %} 288 bytes
|
||||
</pre>
|
||||
{% endhighlight %}
|
||||
<p>{% trans %}Contents:{% endtrans %}</p>
|
||||
<pre>
|
||||
+----+----+----+----+----+----+----+----+
|
||||
@@ -186,13 +184,13 @@ Alice has contacted the wrong router, and Bob drops the connection.
|
||||
<p>{% trans -%}
|
||||
This is the DH reply. Bob sends Alice:
|
||||
{%- endtrans %}</p>
|
||||
<pre>
|
||||
* <----------------------------------------Y+E(H(X+Y)+tsB+padding, sk, Y[239:255])
|
||||
{% highlight %}
|
||||
<----------------------------------------Y+E(H(X+Y)+tsB+padding, sk, Y[239:255])
|
||||
|
||||
{% trans %}Size:{% endtrans %} 304 bytes
|
||||
</pre>
|
||||
{% endhighlight %}
|
||||
<p>{% trans %}Unencrypted Contents:{% endtrans %}</p>
|
||||
<pre>
|
||||
{% highlight %}
|
||||
+----+----+----+----+----+----+----+----+
|
||||
| Y as calculated from DH |
|
||||
+ +
|
||||
@@ -222,7 +220,7 @@ This is the DH reply. Bob sends Alice:
|
||||
|
||||
padding: {% trans %}12 bytes random data{% endtrans %}
|
||||
|
||||
</pre>
|
||||
{% endhighlight %}
|
||||
|
||||
|
||||
<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 -%}
|
||||
This contains Alice's router identity, and a DSA signature of the critical data. Alice sends Bob:
|
||||
{%- endtrans %}</p>
|
||||
<pre>
|
||||
* E(sz+Alice.identity+tsA+padding+S(X+Y+Bob.identHash+tsA+tsB), sk, hX_xor_Bob.identHash[16:31])--->
|
||||
{% highlight %}
|
||||
E(sz+Alice.identity+tsA+padding+S(X+Y+Bob.identHash+tsA+tsB), sk, hX_xor_Bob.identHash[16:31])--->
|
||||
|
||||
{% trans %}Size:{% endtrans %} 448 bytes (typ. for 387 byte identity)
|
||||
</pre>
|
||||
{% endhighlight %}
|
||||
<p>{% trans %}Unencrypted Contents:{% endtrans %}</p>
|
||||
<pre>
|
||||
+----+----+----+----+----+----+----+----+
|
||||
@@ -349,11 +347,11 @@ Bob may drop the connection if the clock skew with Alice is too high as calculat
|
||||
<p>{% trans -%}
|
||||
This is a DSA signature of the critical data. Bob sends Alice:
|
||||
{%- endtrans %}</p>
|
||||
<pre>
|
||||
{% highlight %}
|
||||
* <----------------------E(S(X+Y+Alice.identHash+tsA+tsB)+padding, sk, prev)
|
||||
|
||||
{% trans %}Size:{% endtrans %} 48 bytes
|
||||
</pre>
|
||||
{% endhighlight %}
|
||||
<p>{% trans %}Unencrypted Contents:{% endtrans %}</p>
|
||||
<pre>
|
||||
+----+----+----+----+----+----+----+----+
|
||||
|
@@ -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.
|
||||
{%- endtrans %}</p>
|
||||
|
||||
<pre>
|
||||
{% highlight %}
|
||||
Direct: host, port, introKey, options
|
||||
Indirect: tag, relayhost, port, relayIntroKey, targetIntroKey, options
|
||||
</pre>
|
||||
{% endhighlight %}
|
||||
|
||||
<p>{% trans -%}
|
||||
Each of the addresses may also expose a series of options - special
|
||||
@@ -240,7 +240,7 @@ The message sequence is as follows:
|
||||
<p>{% trans -%}
|
||||
Alice connects directly to Bob.
|
||||
{%- endtrans %}</p>
|
||||
<pre>
|
||||
{% highlight %}
|
||||
Alice Bob
|
||||
SessionRequest --------------------->
|
||||
<--------------------- SessionCreated
|
||||
@@ -249,7 +249,7 @@ Alice connects directly to Bob.
|
||||
<--------------------- DatabaseStoreMessage
|
||||
DatabaseStoreMessage --------------->
|
||||
Data <---------------------------> Data
|
||||
</pre>
|
||||
{% endhighlight %}
|
||||
|
||||
<p>{% trans i2npspec=site_url('docs/spec/i2np') -%}
|
||||
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.
|
||||
{%- endtrans %}</p>
|
||||
|
||||
<pre>
|
||||
{% highlight %}
|
||||
Alice Bob Charlie
|
||||
RelayRequest ---------------------->
|
||||
<-------------- RelayResponse RelayIntro ----------->
|
||||
@@ -336,7 +336,7 @@ Alice first connects to introducer Bob, who relays the request to Charlie.
|
||||
<-------------------------------------------- DatabaseStoreMessage
|
||||
DatabaseStoreMessage -------------------------------------->
|
||||
Data <--------------------------------------------------> Data
|
||||
</pre>
|
||||
{% endhighlight %}
|
||||
|
||||
<p>{% trans -%}
|
||||
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:
|
||||
{%- endtrans %}</p>
|
||||
|
||||
<pre>
|
||||
{% highlight %}
|
||||
Alice Bob Charlie
|
||||
PeerTest ------------------->
|
||||
PeerTest-------------------->
|
||||
@@ -368,7 +368,7 @@ quite simple:
|
||||
<------------------------------------------PeerTest
|
||||
PeerTest------------------------------------------>
|
||||
<------------------------------------------PeerTest
|
||||
</pre>
|
||||
{% endhighlight %}
|
||||
|
||||
<p>{% trans -%}
|
||||
Each of the PeerTest messages carry a nonce identifying the
|
||||
|
Reference in New Issue
Block a user