diff --git a/www.i2p2/pages/i2np_spec.html b/www.i2p2/pages/i2np_spec.html index 12bb0574..973b2b36 100644 --- a/www.i2p2/pages/i2np_spec.html +++ b/www.i2p2/pages/i2np_spec.html @@ -12,65 +12,89 @@ common transports supported.

Common structures

+ +

I2NP message header

+

Description

+

+ Common header to all I2NP messages, which contains important information like an checksum, expiration date, etc. +

+

Contents

+

+ 1 byte Integer specifying the type of this message, followed by an 4 byte Integer specifying the message-id. After that there is an expiration Date, followed by an 2 byte Integer specifying the length of the message payload, followed by an Hash, which is truncated to the first byte. After that the actual message data follows. +

 {% filter escape %}
++----+----+----+----+----+
+|type| msg-id            |
 +----+----+----+----+----+----+----+----+
-|type| msg-id            | expiration
+| expiration                            |
 +----+----+----+----+----+----+----+----+
- date                    | size    |chks|
-+----+----+----+----+----+----+----+----+
-| data .....
-+----+---//
+| size    |chks|
++----+----+----+
 {% endfilter %}
 

Definition

 {% filter escape %}
-type:
-     1 byte
-     identifies the message type(see table below)
+type :: Integer
+        length -> 1 byte
+        
+        purpose -> identifies the message type(see table below)
 
-msg-id:
-       4 bytes
-       uniquely identifies this message(for some time at least)
+msg-id :: Integer
+          length -> 4 bytes
 
-expiration:
+          purpose -> uniquely identifies this message(for some time at least)
+
+expiration :: Date
            8 bytes
            date this message will expire
 
-size:
-     2 bytes
-     length of the payload
+size :: Integer
+        length -> 2 bytes
+        
+        purpose -> length of the payload
 
-chks:
-     1 byte
-     checksum of the payload
-     SHA256 hash truncated to the first byte
+chks :: Hash
+        length -> 1 byte
+     
+        purpose -> checksum of the payload
+                   SHA256 hash truncated to the first byte
 
-data:
-     $size bytes
-     actual message contents
+data :: Data
+        length -> $size bytes
+        
+        purpose -> actual message contents
 {% endfilter %}
 

BuildRequestRecord

+

Description

+

+ One Record in a set of multiple records to request the creation of one hop in the tunnel. For more details see here. +

+

Contents

+

+ TunnelId to receive messages on, followed by the Hash of our RouterIdentity. After that the TunnelId and the Hash of the next router's RouterIdentity follow. +

+

Definition

 {% filter escape %}
 Cleartext:
 +----+----+----+----+----+----+----+----+
-| receive tunnelId  | local routerInfo  |
-+----+----+----+----+ hash              +
+| receive_tunnel    | our_ident         |
++----+----+----+----+                   +
 |                                       |
 +                                       +
 |                                       |
 +                                       +
 |                                       |
 +                   +----+----+----+----+
-|                   | 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,13 +126,13 @@ Cleartext:
 +                                       +
 |                                       |
 +----+----+----+----+----+----+----+----+
-| reply IV                              |
+| reply_iv                              |
 +                                       +
 |                                       |
-+----+----+----+----+----+----+----+----+
-|flag| request time      | next msg-id
-+----+----+----+----+----+----+----+----+
-     | padding...
++----+----+----+----+----+----+----+----+----+
+|flag| request_time      | send_message_id   |
++----+----+----+----+----+----+----+----+----+
+| padding...
 +----+----+----+--//
 
 encrypted:
@@ -127,23 +151,51 @@ encrypted:
 
 {% filter escape %}
 unencrypted:
- *   bytes     0-3: tunnel ID to receive messages as                                                                                                                                                                
- *   bytes    4-35: local router identity hash                                                                                                                                                                      
- *   bytes   36-39: next tunnel ID                                                                                                                                                                                  
- *   bytes   40-71: next router identity hash                                                                                                                                                                       
- *   bytes  72-103: AES-256 tunnel layer key                                                                                                                                                                        
- *   bytes 104-135: AES-256 tunnel IV key                                                                                                                                                                           
- *   bytes 136-167: AES-256 reply key                                                                                                                                                                               
- *   bytes 168-183: reply IV                                                                                                                                                                                        
- *   byte      184: flags                                                                                                                                                                                           
- *   bytes 185-188: request time (in hours since the epoch)                                                                                                                                                         
- *   bytes 189-192: next message ID                                                                                                                                                                                 
- *   bytes 193-222: uninterpreted / random padding
-Taken from i2p.i2p/router/java/src/net/i2p/data/i2np/BuildRequestRecord.java
+
+receive_tunnel :: TunnelId
+                  length -> 4 bytes
+our_ident :: Hash
+             length -> 32 bytes
+
+next_tunnel :: TunnelId
+               length -> 4 bytes
+
+next_ident :: Hash
+              length -> 32 bytes
+
+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:
-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 %}