From 7fd00fe33026f967a51884a097db30deb8cd1b3f Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Tue, 28 Jan 2014 14:51:51 +0000
Subject: [PATCH] Streaming spec update for variable signatures Add link to
 streaming spec on doc index

---
 i2p2www/pages/site/docs/index.html            |  6 ++--
 .../site/docs/spec/common-structures.html     |  7 +++-
 i2p2www/pages/site/docs/spec/streaming.html   | 33 ++++++++++++++++---
 3 files changed, 38 insertions(+), 8 deletions(-)

diff --git a/i2p2www/pages/site/docs/index.html b/i2p2www/pages/site/docs/index.html
index 3ac5c0244..537d60545 100644
--- a/i2p2www/pages/site/docs/index.html
+++ b/i2p2www/pages/site/docs/index.html
@@ -1,7 +1,7 @@
 {% extends "global/layout.html" %}
 {% block title %}{% trans %}Index to Technical Documentation{% endtrans %}{% endblock %}
-{% block lastupdated %}{% trans %}May 2013{% endtrans %}{% endblock %}
-{% block accuratefor %}0.9.6{% endblock %}
+{% block lastupdated %}{% trans %}January 2014{% endtrans %}{% endblock %}
+{% block accuratefor %}0.9.10{% endblock %}
 {% block content %}
 <p>{% trans -%}
 Following is an index to the technical documentation for I2P.
@@ -81,6 +81,8 @@ HTTP Bidir Proxy
 <ul><li>
 <a href="{{ site_url('docs/api/streaming') }}">{{ _('Streaming Library') }}</a>
 </li><li>
+<a href="{{ site_url('docs/spec/streaming') }}">{{ _('Streaming Protocol Specification') }}</a>
+</li><li>
 <a href="http://docs.i2p-projekt.de/javadoc/net/i2p/client/streaming/package-summary.html">{{ _('Streaming Javadoc') }}</a>
 </li><li>
 <a href="{{ site_url('docs/spec/datagrams') }}">{{ _('Datagrams') }}</a>
diff --git a/i2p2www/pages/site/docs/spec/common-structures.html b/i2p2www/pages/site/docs/spec/common-structures.html
index 60324d909..07102c717 100644
--- a/i2p2www/pages/site/docs/spec/common-structures.html
+++ b/i2p2www/pages/site/docs/spec/common-structures.html
@@ -1,7 +1,7 @@
 {% extends "global/layout.html" %}
 {% block title %}{% trans %}Common structures Specification{% endtrans %}{% endblock %}
 {% block lastupdated %}{% trans %}January 2014{% endtrans %}{% endblock %}
-{% block accuratefor %}0.9.9{% endblock %}
+{% block accuratefor %}0.9.10{% endblock %}
 {% block content %}
 <p>{% trans i2np=site_url('docs/protocol/i2np'),
 i2cp=site_url('docs/protocol/i2cp'),
@@ -505,6 +505,8 @@ total length: 387+ bytes
 <ul><li>{% trans -%}
 The certificate for a RouterIdentity is currently unused and is always NULL.
 {%- endtrans %}</li><li>
+Do not assume that RouterIdentities are always 387 bytes!
+They are 387 bytes plus the certificate length specified at bytes 385-386, which may be non-zero in a future release.
 </li><li>
 As of release 0.9.11, if the certificate is a Key Certificate, the boundaries of the
 key fields may vary. See the Key Certificate section above for details.
@@ -561,6 +563,9 @@ which was disabled in version 0.6, it is currently unused
 except for the IV for LeaseSet encryption,
 which is deprecated. The public key in the LeaseSet is used instead.
 </li><li>
+Do not assume that Destinations are always 387 bytes!
+They are 387 bytes plus the certificate length specified at bytes 385-386, which may be non-zero.
+</li><li>
 As of release 0.9.11, if the certificate is a Key Certificate, the boundaries of the
 key fields may vary. See the Key Certificate section above for details.
 </li></ul>
diff --git a/i2p2www/pages/site/docs/spec/streaming.html b/i2p2www/pages/site/docs/spec/streaming.html
index c22ca15dc..e73c0b96b 100644
--- a/i2p2www/pages/site/docs/spec/streaming.html
+++ b/i2p2www/pages/site/docs/spec/streaming.html
@@ -1,7 +1,7 @@
 {% extends "global/layout.html" %}
 {% block title %}{% trans %}Streaming Library Specification{% endtrans %}{% endblock %}
-{% block lastupdated %}{% trans %}December 2013{% endtrans %}{% endblock %}
-{% block accuratefor %}0.9.9{% endblock %}
+{% block lastupdated %}{% trans %}January 2014{% endtrans %}{% endblock %}
+{% block accuratefor %}0.9.10{% endblock %}
 {% block content %}
 <p><a href="{{ site_url('docs/api/streaming') }}">{% trans -%}
 See the Streaming page for an overview of the Streaming Library.
@@ -103,13 +103,16 @@ SIGNATURE_INCLUDED must be set also.
 <tr><td>2<td>RESET<td align="center">--<td align="center">--<td>
 Abnormal close.
 SIGNATURE_INCLUDED must be set also.
-<tr><td>3<td>SIGNATURE_INCLUDED<td align="center">4<td>40 byte <a href="{{ site_url('docs/spec/common-structures') }}#type_Signature">DSA Signature</a>
+<tr><td>3<td>SIGNATURE_INCLUDED<td align="center">4<td>variable length <a href="{{ site_url('docs/spec/common-structures') }}#type_Signature">Signature</a>
 <td>
 Currently sent only with SYNCHRONIZE, CLOSE, and RESET, where it is required,
 and with ECHO, where it is required for a ping.
-The signature uses the Destination's <a href="{{ site_url('docs/spec/common-structures') }}#type_SigningPublicKey">DSA signing keys</a> 
-to sign the entire header and payload with the 40-byte space in the option data field 
+The signature uses the Destination's <a href="{{ site_url('docs/spec/common-structures') }}#type_SigningPublicKey">signing keys</a> 
+to sign the entire header and payload with the space in the option data field 
 for the signature being set to all zeroes.
+<br>
+Prior to release 0.9.11, the signature was always 40 bytes.
+As of release 0.9.11, the signature may be variable-length, see below for details.
 <tr><td>4<td>SIGNATURE_REQUESTED<td align="center">--<td align="center">--<td>
 Unused. Requests every packet in the other direction to have SIGNATURE_INCLUDED
 <tr><td>5<td>FROM_INCLUDED<td align="center">2<td>387+ byte <a href="{{ site_url('docs/spec/common-structures') }}#struct_Destination">Destination</a>
@@ -138,4 +141,24 @@ and is always present.
 <tr><td>11-15<td>unused<td><td><td>
 </table>
 
+<h4>Variable Length Signature Notes</h4>
+<p>
+Prior to release 0.9.11, the signature in the option field was always 40 bytes.
+As of release 0.9.11, the signature is variable length.
+The Signature type and length are inferred from the type of key used in the FROM_INCLUDED option
+and the <a href="{{ site_url('docs/spec/common-structures') }}#type_Signature">Signature documentation</a>.
+<ul><li>
+When a packet contains both FROM_INCLUDED and SIGNATURE_INCLUDED (as in SYNCHRONIZE), the inference may be made directly.
+</li><li>
+When a packet does not contain FROM_INCLUDED, the inference must be made from a previous SYNCHRONIZE packet.
+</li><li>
+When a packet does not contain FROM_INCLUDED, and there was no previous SYNCHRONIZE packet
+(for example a stray CLOSE or RESET packet), the inference can be made from the length of the remaining options
+(since SIGNATURE_INCLUDED is the last option), but the packet will probably be discarded anyway, since there is no FROM available
+to validate the signature.
+If more option fields are defined in the future, they must be accounted for.
+</li></ul>
+</p>
+
+
 {% endblock %}
-- 
GitLab