update i2np spec a bit
This commit is contained in:
@ -12,65 +12,89 @@ common transports supported.
|
|||||||
|
|
||||||
<h2 id="structures">Common structures</h2>
|
<h2 id="structures">Common structures</h2>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h3 id="struct_header">I2NP message header</h3>
|
<h3 id="struct_header">I2NP message header</h3>
|
||||||
|
<h4>Description</h4>
|
||||||
|
<p>
|
||||||
|
Common header to all I2NP messages, which contains important information like an checksum, expiration date, etc.
|
||||||
|
</p>
|
||||||
|
<h4>Contents</h4>
|
||||||
|
<p>
|
||||||
|
1 byte <a href="common_structures_spec#type_Integer">Integer</a> specifying the type of this message, followed by an 4 byte <a href="common_structures_spec#type_Integer">Integer</a> specifying the message-id. After that there is an expiration <a href="common_structures_spec#type_Date">Date</a>, followed by an 2 byte <a href="common_structures_spec#type_Integer">Integer</a> specifying the length of the message payload, followed by an <a href="common_structures_spec#type_Hash">Hash</a>, which is truncated to the first byte. After that the actual message data follows.
|
||||||
|
</p>
|
||||||
<pre>
|
<pre>
|
||||||
{% filter escape %}
|
{% filter escape %}
|
||||||
|
+----+----+----+----+----+
|
||||||
|
|type| msg-id |
|
||||||
+----+----+----+----+----+----+----+----+
|
+----+----+----+----+----+----+----+----+
|
||||||
|type| msg-id | expiration
|
| expiration |
|
||||||
+----+----+----+----+----+----+----+----+
|
+----+----+----+----+----+----+----+----+
|
||||||
date | size |chks|
|
| size |chks|
|
||||||
+----+----+----+----+----+----+----+----+
|
+----+----+----+
|
||||||
| data .....
|
|
||||||
+----+---//
|
|
||||||
{% endfilter %}
|
{% endfilter %}
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h4>Definition</h4>
|
<h4>Definition</h4>
|
||||||
<pre>
|
<pre>
|
||||||
{% filter escape %}
|
{% filter escape %}
|
||||||
type:
|
type :: Integer
|
||||||
1 byte
|
length -> 1 byte
|
||||||
identifies the message type(see table below)
|
|
||||||
|
|
||||||
msg-id:
|
purpose -> identifies the message type(see table below)
|
||||||
4 bytes
|
|
||||||
uniquely identifies this message(for some time at least)
|
|
||||||
|
|
||||||
expiration:
|
msg-id :: Integer
|
||||||
|
length -> 4 bytes
|
||||||
|
|
||||||
|
purpose -> uniquely identifies this message(for some time at least)
|
||||||
|
|
||||||
|
expiration :: Date
|
||||||
8 bytes
|
8 bytes
|
||||||
date this message will expire
|
date this message will expire
|
||||||
|
|
||||||
size:
|
size :: Integer
|
||||||
2 bytes
|
length -> 2 bytes
|
||||||
length of the payload
|
|
||||||
|
|
||||||
chks:
|
purpose -> length of the payload
|
||||||
1 byte
|
|
||||||
checksum of the payload
|
chks :: Hash
|
||||||
|
length -> 1 byte
|
||||||
|
|
||||||
|
purpose -> checksum of the payload
|
||||||
SHA256 hash truncated to the first byte
|
SHA256 hash truncated to the first byte
|
||||||
|
|
||||||
data:
|
data :: Data
|
||||||
$size bytes
|
length -> $size bytes
|
||||||
actual message contents
|
|
||||||
|
purpose -> actual message contents
|
||||||
{% endfilter %}
|
{% endfilter %}
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h3 id="struct_BuildRequestRecord">BuildRequestRecord</h3>
|
<h3 id="struct_BuildRequestRecord">BuildRequestRecord</h3>
|
||||||
|
<h4>Description</h4>
|
||||||
|
<p>
|
||||||
|
One Record in a set of multiple records to request the creation of one hop in the tunnel. For more details see here.
|
||||||
|
</p>
|
||||||
|
<h4>Contents</h4>
|
||||||
|
<p>
|
||||||
|
<a href="common_structures_spec#type_TunnelId">TunnelId</a> to receive messages on, followed by the <a href="common_structures_spec#type_Hash">Hash</a> of our <a href="common_structures_spec#struct_RouterIdentity">RouterIdentity</a>. After that the <a href="common_structures_spec#type_TunnelId">TunnelId</a> and the <a href="common_structures_spec#type_Hash">Hash</a> of the next router's <a href="common_structures_spec#struct_RouterIdentity">RouterIdentity</a> follow.
|
||||||
|
</p>
|
||||||
|
<h4>Definition</h4>
|
||||||
<pre>
|
<pre>
|
||||||
{% filter escape %}
|
{% filter escape %}
|
||||||
Cleartext:
|
Cleartext:
|
||||||
+----+----+----+----+----+----+----+----+
|
+----+----+----+----+----+----+----+----+
|
||||||
| receive tunnelId | local routerInfo |
|
| receive_tunnel | our_ident |
|
||||||
+----+----+----+----+ hash +
|
+----+----+----+----+ +
|
||||||
| |
|
| |
|
||||||
+ +
|
+ +
|
||||||
| |
|
| |
|
||||||
+ +
|
+ +
|
||||||
| |
|
| |
|
||||||
+ +----+----+----+----+
|
+ +----+----+----+----+
|
||||||
| | send tunnelId |
|
| | next_tunnel |
|
||||||
+----+----+----+----+----+----+----+----+
|
+----+----+----+----+----+----+----+----+
|
||||||
| nexthop routerInfo hash |
|
| next_ident |
|
||||||
+ +
|
+ +
|
||||||
| |
|
| |
|
||||||
+ +
|
+ +
|
||||||
@ -78,7 +102,7 @@ Cleartext:
|
|||||||
+ +
|
+ +
|
||||||
| |
|
| |
|
||||||
+----+----+----+----+----+----+----+----+
|
+----+----+----+----+----+----+----+----+
|
||||||
| AES256 tunnel layer key |
|
| layer_key |
|
||||||
+ +
|
+ +
|
||||||
| |
|
| |
|
||||||
+ +
|
+ +
|
||||||
@ -86,7 +110,7 @@ Cleartext:
|
|||||||
+ +
|
+ +
|
||||||
| |
|
| |
|
||||||
+----+----+----+----+----+----+----+----+
|
+----+----+----+----+----+----+----+----+
|
||||||
| AES256 tunnel IV key |
|
| iv_key |
|
||||||
+ +
|
+ +
|
||||||
| |
|
| |
|
||||||
+ +
|
+ +
|
||||||
@ -94,7 +118,7 @@ Cleartext:
|
|||||||
+ +
|
+ +
|
||||||
| |
|
| |
|
||||||
+----+----+----+----+----+----+----+----+
|
+----+----+----+----+----+----+----+----+
|
||||||
| AES256 reply key |
|
| reply_key |
|
||||||
+ +
|
+ +
|
||||||
| |
|
| |
|
||||||
+ +
|
+ +
|
||||||
@ -102,12 +126,12 @@ Cleartext:
|
|||||||
+ +
|
+ +
|
||||||
| |
|
| |
|
||||||
+----+----+----+----+----+----+----+----+
|
+----+----+----+----+----+----+----+----+
|
||||||
| reply IV |
|
| reply_iv |
|
||||||
+ +
|
+ +
|
||||||
| |
|
| |
|
||||||
+----+----+----+----+----+----+----+----+
|
+----+----+----+----+----+----+----+----+----+
|
||||||
|flag| request time | next msg-id
|
|flag| request_time | send_message_id |
|
||||||
+----+----+----+----+----+----+----+----+
|
+----+----+----+----+----+----+----+----+----+
|
||||||
| padding...
|
| padding...
|
||||||
+----+----+----+--//
|
+----+----+----+--//
|
||||||
|
|
||||||
@ -127,23 +151,51 @@ encrypted:
|
|||||||
<pre>
|
<pre>
|
||||||
{% filter escape %}
|
{% filter escape %}
|
||||||
unencrypted:
|
unencrypted:
|
||||||
* bytes 0-3: tunnel ID to receive messages as
|
|
||||||
* bytes 4-35: local router identity hash
|
receive_tunnel :: TunnelId
|
||||||
* bytes 36-39: next tunnel ID
|
length -> 4 bytes
|
||||||
* bytes 40-71: next router identity hash
|
our_ident :: Hash
|
||||||
* bytes 72-103: AES-256 tunnel layer key
|
length -> 32 bytes
|
||||||
* bytes 104-135: AES-256 tunnel IV key
|
|
||||||
* bytes 136-167: AES-256 reply key
|
next_tunnel :: TunnelId
|
||||||
* bytes 168-183: reply IV
|
length -> 4 bytes
|
||||||
* byte 184: flags
|
|
||||||
* bytes 185-188: request time (in hours since the epoch)
|
next_ident :: Hash
|
||||||
* bytes 189-192: next message ID
|
length -> 32 bytes
|
||||||
* bytes 193-222: uninterpreted / random padding
|
|
||||||
Taken from i2p.i2p/router/java/src/net/i2p/data/i2np/BuildRequestRecord.java
|
layer_key :: SessionKey
|
||||||
|
length -> 32 bytes
|
||||||
|
|
||||||
|
iv_key :: SessionKey
|
||||||
|
length -> 32 bytes
|
||||||
|
|
||||||
|
reply_key :: SessionKey
|
||||||
|
length -> 32 bytes
|
||||||
|
|
||||||
|
reply_iv :: Integer
|
||||||
|
length -> 16 bytes
|
||||||
|
|
||||||
|
flag :: Integer
|
||||||
|
length -> 1 byte
|
||||||
|
|
||||||
|
request_time :: Integer
|
||||||
|
length -> 4 bytes
|
||||||
|
|
||||||
|
send_message_id :: Integer
|
||||||
|
length -> 4 bytes
|
||||||
|
|
||||||
|
padding :: Data
|
||||||
|
length -> 29 bytes
|
||||||
|
|
||||||
|
source -> random
|
||||||
|
|
||||||
encrypted:
|
encrypted:
|
||||||
bytes 0-15: SHA-256-128(SHA256 hash truncated to 128bit) of the current hop's identity (the toPeer parameter)
|
|
||||||
bytes 15-527: ElGamal-2048 encrypted block
|
toPeer :: Hash
|
||||||
|
length -> 16 bytes
|
||||||
|
|
||||||
|
encrypted_data :: ElGamal-2048 encrypted data
|
||||||
|
length -> 514
|
||||||
|
|
||||||
{% endfilter %}
|
{% endfilter %}
|
||||||
</pre>
|
</pre>
|
||||||
|
Reference in New Issue
Block a user