From ad32d2d138e9b458d73cc1a43ce9e1495929a279 Mon Sep 17 00:00:00 2001
From: zzz
Date: Fri, 10 Jan 2014 15:56:46 +0000
Subject: [PATCH] Preliminary Key Certificate spec Add table of certificate
types
---
.../site/docs/spec/common-structures.html | 115 +++++++++++++++++-
1 file changed, 112 insertions(+), 3 deletions(-)
diff --git a/i2p2www/pages/site/docs/spec/common-structures.html b/i2p2www/pages/site/docs/spec/common-structures.html
index dbb7b2de..0e985055 100644
--- a/i2p2www/pages/site/docs/spec/common-structures.html
+++ b/i2p2www/pages/site/docs/spec/common-structures.html
@@ -1,6 +1,6 @@
{% extends "global/layout.html" %}
{% block title %}{% trans %}Common structures Specification{% endtrans %}{% endblock %}
-{% block lastupdated %}{% trans %}December 2013{% endtrans %}{% endblock %}
+{% block lastupdated %}{% trans %}January 2014{% endtrans %}{% endblock %}
{% block accuratefor %}0.9.9{% endblock %}
{% block content %}
{% trans i2np=site_url('docs/protocol/i2np'),
@@ -219,6 +219,108 @@ however non-NULL certs are not widely used, and any checking is left to the appl
{%- endtrans %}
+
{% trans %}Certificate Types{% endtrans %}
+The following certificate types are defined:
+
+Type | Type Code | Payload Length | Total Length | Notes/th> |
+Null | 0 | 0 | 3 | |
+HashCash | 1 | varies | varies |
+ Experimental, unused. Payload contains an ASCII colon-separated hashcash string.
+ |
+Hidden | 2 | 0 | 3 |
+ Experimental, unused. Hidden routers generally do not announce that they are hidden.
+ |
+Signed | 3 | 40 or 72 | 43 or 75 |
+ Experimental, unused. Payload contains a 40-byte DSA signature,
+ optionally followed by the 32-byte Hash of the signing Destination.
+ |
+Multiple | 4 | varies | varies |
+ Experimental, unused. Payload contains multiple certificates.
+ |
+Key | 5 | 4+ | 7+ |
+ Since 0.9.11. See below for details.
+ |
+
+
+
+{% trans %}Key Certificates{% endtrans %}
+
+Key certificates are preliminary, and are scheduled to be introduced in release 0.9.11.
+Prior to that release, all PublicKeys were 256-byte ElGamal keys, and
+all SigningPublicKeys were 128-byte DSA-160 keys.
+A key certificate provides a mechanism to indicate the type of the PublicKey and SigningPublicKey
+in the Destination or RouterIdentity, and to package any key data in excess of the
+standard lengths.
+
+By maintaining exactly 384 bytes before the certificate, and putting any excess key
+data inside the certificate, we maintain compatibility for any software that
+parses Destinations and RouterIdentities.
+
+
+The key certificate payload contains:
+
+Data | Length |
+Signing Public Key Type | 2 |
+Crypto Public Key Type | 2 |
+Excess Signing Public Key Data | 0+ |
+Excess Crypto Public Key Data | 0+ |
+
+
+
+The defined Signing Key types are:
+
+Type | Type Code | Total Public Key Length |
+DSA-160 | 0 | 128 |
+ECDSA-SHA256-P256 | 1 | 64 |
+ECDSA-SHA384-P384 | 2 | 96 |
+ECDSA-SHA512-P521 | 3 | 132 |
+RSA-SHA256-2048 | 4 | 512 |
+RSA-SHA384-3072 | 5 | 768 |
+RSA-SHA512-4096 | 6 | 1024 |
+
+
+
+The defined Crypto Public Key types are:
+
+Type | Type Code | Total Public Key Length |
+ElGamal | 0 | 256 |
+
+
+
+When a Key Certificate is not present, the preceeding 384 bytes in the Destination or RouterIdentity
+are defined as the 256-byte ElGamal PublicKey followed by the 128-byte DSA-160 SigningPublicKey.
+When a Key Certificate is present, the preceeding 384 bytes are redefined as follows:
+
-
+Complete or first portion of Crypto Public Key
+
-
+Random padding if the total lengths of the two keys are less than 384 bytes
+
-
+Complete or first portion of Signing Public Key
+
+
+The lengths and boundaries of the initial key data, the padding, and the excess key data portions
+in the certificates are not explicitly specified, but are derived from
+the lengths of the specified key types.
+If the total lengths of the Crypto and Signing Public Keys exceed 384 bytes,
+the remainder will be contained in the Key Certificate.
+If the Crypto Public Key length is not 256 bytes, the method for determining
+the boundary between the two keys is to be specified in a future revision of this document.
+
+
+
+Example layouts using an ElGamal Crypto Public Key and the Signing Public Key type indicated:
+
+Signing Key Type | Padding Length | Excess Signing Key Data in Cert |
+DSA-160 | 0 | 0 |
+ECDSA-SHA256-P256 | 64 | 0 |
+ECDSA-SHA384-P384 | 32 | 0 |
+ECDSA-SHA512-P521 | 0 | 4 |
+RSA-SHA256-2048 | 0 | 384 |
+RSA-SHA384-3072 | 0 | 648 |
+RSA-SHA512-4096 | 0 | 896 |
+
+
+
@@ -348,9 +450,13 @@ total length: 387+ bytes
{% endhighlight %}
{% trans %}Notes{% endtrans %}
-{% trans -%}
+
- {% trans -%}
The certificate for a RouterIdentity is currently unused and is always NULL.
-{%- endtrans %}
+{%- endtrans %}
-
+
-
+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.
+
@@ -402,6 +508,9 @@ The public key of the destination was used for the old i2cp-to-i2cp encryption
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.
+
+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.