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 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)----------------------------->
|
X+(H(X) xor Bob.identHash)----------------------------->
|
||||||
* <----------------------------------------Y+E(H(X+Y)+tsB+padding, sk, Y[239:255])
|
<----------------------------------------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(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)
|
<----------------------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)----------------------------->
|
X+(H(X) xor Bob.identHash)----------------------------->
|
||||||
|
|
||||||
{% 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 %}
|
||||||
* <----------------------------------------Y+E(H(X+Y)+tsB+padding, sk, Y[239:255])
|
<----------------------------------------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])--->
|
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)
|
{% 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 %}
|
||||||
* <----------------------E(S(X+Y+Alice.identHash+tsA+tsB)+padding, sk, prev)
|
* <----------------------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>
|
||||||
+----+----+----+----+----+----+----+----+
|
+----+----+----+----+----+----+----+----+
|
||||||
|
@@ -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 --------------------->
|
SessionRequest --------------------->
|
||||||
<--------------------- SessionCreated
|
<--------------------- SessionCreated
|
||||||
@@ -249,7 +249,7 @@ Alice connects directly to Bob.
|
|||||||
<--------------------- DatabaseStoreMessage
|
<--------------------- DatabaseStoreMessage
|
||||||
DatabaseStoreMessage --------------->
|
DatabaseStoreMessage --------------->
|
||||||
Data <---------------------------> Data
|
Data <---------------------------> 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 ---------------------->
|
RelayRequest ---------------------->
|
||||||
<-------------- RelayResponse RelayIntro ----------->
|
<-------------- RelayResponse RelayIntro ----------->
|
||||||
@@ -336,7 +336,7 @@ Alice first connects to introducer Bob, who relays the request to Charlie.
|
|||||||
<-------------------------------------------- DatabaseStoreMessage
|
<-------------------------------------------- DatabaseStoreMessage
|
||||||
DatabaseStoreMessage -------------------------------------->
|
DatabaseStoreMessage -------------------------------------->
|
||||||
Data <--------------------------------------------------> Data
|
Data <--------------------------------------------------> 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 ------------------->
|
PeerTest ------------------->
|
||||||
PeerTest-------------------->
|
PeerTest-------------------->
|
||||||
@@ -368,7 +368,7 @@ quite simple:
|
|||||||
<------------------------------------------PeerTest
|
<------------------------------------------PeerTest
|
||||||
PeerTest------------------------------------------>
|
PeerTest------------------------------------------>
|
||||||
<------------------------------------------PeerTest
|
<------------------------------------------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
|
||||||
|
Reference in New Issue
Block a user