lsd0001

LSD0001: GNU Name System
Log | Files | Refs | README

commit ef0496e0e8816b0937ccb6db51898bc5037c0891
parent 8c46f2fc9c49a85c8d75aa794798444e112a7980
Author: Schanzenbach, Martin <mschanzenbach@posteo.de>
Date:   Tue, 10 Sep 2019 19:25:48 +0200

update flags

Diffstat:
Mdraft-schanzen-gns.html | 66+++++++++++++++++++++++++++++++++++++++++++++++++++---------------
Mdraft-schanzen-gns.txt | 310+++++++++++++++++++++++++++++++++++++++++++++++--------------------------------
Mdraft-schanzen-gns.xml | 63++++++++++++++++++++++++++++++++++++++++++++++++---------------
3 files changed, 282 insertions(+), 157 deletions(-)

diff --git a/draft-schanzen-gns.html b/draft-schanzen-gns.html @@ -1209,7 +1209,43 @@ async function addMetadata(){try{const e=document.styleSheets[0].cssRules;for(le <h3 id="name-flags"> <a href="#section-3.1" class="section-number selfRef">3.1. </a><a href="#name-flags" class="section-name selfRef">Flags</a> </h3> -<p id="section-3.1-1">TODO flags<a href="#section-3.1-1" class="pilcrow">¶</a></p> +<p id="section-3.1-1"> + Flags indicate metadata surrounding the resource record. A flag + value of 0 indicates that all flags are unset. The following + illustrates the flag distribution in the 32-bit flag value of a + resource record:<a href="#section-3.1-1" class="pilcrow">¶</a></p> +<div id="figure_flag"> +<figure id="figure-2"> + <div class="artwork art-text alignLeft" id="section-3.1-2.1"> +<pre> + ... 5 4 3 2 1 0 + ------+--------+--------+--------+--------+--------+ + / ... | SHADOW | EXPREL | / | PRIVATE| / | + ------+--------+--------+--------+--------+--------+ + </pre> +</div> +<figcaption><a href="#figure-2" class="selfRef">Figure 2</a></figcaption></figure> +</div> +<p id="section-3.1-3"> + where:<a href="#section-3.1-3" class="pilcrow">¶</a></p> +<dl class="dlParallel" id="section-3.1-4"> + <dt id="section-3.1-4.1">SHADOW</dt> + <dd id="section-3.1-4.2"> + If this flag is set, this record should not be used unless all (other) + records with an absolute expiration time have expired.<a href="#section-3.1-4.2" class="pilcrow">¶</a> +</dd> + <dt id="section-3.1-4.3">EXPREL</dt> + <dd id="section-3.1-4.4"> + The expiration time value of the record is a relative time and not + an absolute time. This flag can be ignored by a resolver.<a href="#section-3.1-4.4" class="pilcrow">¶</a> +</dd> + <dt id="section-3.1-4.5">PRIVATE</dt> + <dd id="section-3.1-4.6"> + This is a private record of this peer and it should thus not be + handed out to other peers. This flag should never be encountered by + a resolver.<a href="#section-3.1-4.6" class="pilcrow">¶</a> +</dd> + </dl> </section> </div> <div id="gnsrecords"> @@ -1219,7 +1255,7 @@ async function addMetadata(){try{const e=document.styleSheets[0].cssRules;for(le </h3> <p id="section-3.2-1">The a PKEY DATA entry has the following format:<a href="#section-3.2-1" class="pilcrow">¶</a></p> <div id="figure_pkeyrecord"> -<figure id="figure-2"> +<figure id="figure-3"> <div class="artwork art-text alignLeft" id="section-3.2-2.1"> <pre> 0 8 16 24 32 40 48 56 @@ -1231,7 +1267,7 @@ async function addMetadata(){try{const e=document.styleSheets[0].cssRules;for(le +-----+-----+-----+-----+-----+-----+-----+-----+ </pre> </div> -<figcaption><a href="#figure-2" class="selfRef">Figure 2</a></figcaption></figure> +<figcaption><a href="#figure-3" class="selfRef">Figure 3</a></figcaption></figure> </div> </section> </div> @@ -1251,7 +1287,7 @@ async function addMetadata(){try{const e=document.styleSheets[0].cssRules;for(le Given a label "l", the DHT key "q" is derived as follows:<a href="#section-4-1" class="pilcrow">¶</a></p> <div class="artwork art-text alignLeft" id="section-4-2"> <pre> - h := sha512 (l,y) + h := HKDF ("key-derivation", l|y|"gns") d := h*x mod p q := sha512 (d*P) </pre><a href="#section-4-2" class="pilcrow">¶</a> @@ -1286,7 +1322,7 @@ async function addMetadata(){try{const e=document.styleSheets[0].cssRules;for(le encryption scheme. A GNS resource records block has the following format:<a href="#section-4.1-1" class="pilcrow">¶</a></p> <div id="figure_record_block"> -<figure id="figure-3"> +<figure id="figure-4"> <div class="artwork art-text alignLeft" id="section-4.1-2.1"> <pre> 0 8 16 24 32 40 48 56 @@ -1315,7 +1351,7 @@ async function addMetadata(){try{const e=document.styleSheets[0].cssRules;for(le +-----+-----+-----+-----+-----+-----+-----+-----+ </pre> </div> -<figcaption><a href="#figure-3" class="selfRef">Figure 3</a></figcaption></figure> +<figcaption><a href="#figure-4" class="selfRef">Figure 4</a></figcaption></figure> </div> <p id="section-4.1-3">where:<a href="#section-4.1-3" class="pilcrow">¶</a></p> <dl class="dlParallel" id="section-4.1-4"> @@ -1382,7 +1418,7 @@ async function addMetadata(){try{const e=document.styleSheets[0].cssRules;for(le We divide the resulting 512-bit "K" into a 256-bit AES key "Kaes" and a 256-bit TWOFISH key "Ktwo":<a href="#section-4.1.1-3" class="pilcrow">¶</a></p> <div id="figure_hkdf_keys"> -<figure id="figure-4"> +<figure id="figure-5"> <div class="artwork art-text alignLeft" id="section-4.1.1-4.1"> <pre> 0 8 16 24 32 40 48 56 @@ -1399,13 +1435,13 @@ async function addMetadata(){try{const e=document.styleSheets[0].cssRules;for(le +-----+-----+-----+-----+-----+-----+-----+-----+ </pre> </div> -<figcaption><a href="#figure-4" class="selfRef">Figure 4</a></figcaption></figure> +<figcaption><a href="#figure-5" class="selfRef">Figure 5</a></figcaption></figure> </div> <p id="section-4.1.1-5"> Similarly, we divide "IV" into a 128-bit initialization vector IVaes and a 128-bit initialization vector IVtwo:<a href="#section-4.1.1-5" class="pilcrow">¶</a></p> <div id="figure_hkdf_ivs"> -<figure id="figure-5"> +<figure id="figure-6"> <div class="artwork art-text alignLeft" id="section-4.1.1-6.1"> <pre> 0 8 16 24 32 40 48 56 @@ -1418,7 +1454,7 @@ async function addMetadata(){try{const e=document.styleSheets[0].cssRules;for(le +-----+-----+-----+-----+-----+-----+-----+-----+ </pre> </div> -<figcaption><a href="#figure-5" class="selfRef">Figure 5</a></figcaption></figure> +<figcaption><a href="#figure-6" class="selfRef">Figure 6</a></figcaption></figure> </div> <p id="section-4.1.1-7"> The symmetric keys and IVs are used for a AES+TWOFISH combined @@ -1432,7 +1468,7 @@ async function addMetadata(){try{const e=document.styleSheets[0].cssRules;for(le <p id="section-4.1.1-9"> The decrypted RDATA has the following format:<a href="#section-4.1.1-9" class="pilcrow">¶</a></p> <div id="figure_rdata"> -<figure id="figure-6"> +<figure id="figure-7"> <div class="artwork art-text alignLeft" id="section-4.1.1-10.1"> <pre> 0 8 16 24 32 40 48 56 @@ -1458,18 +1494,18 @@ async function addMetadata(){try{const e=document.styleSheets[0].cssRules;for(le / / </pre> </div> -<figcaption><a href="#figure-6" class="selfRef">Figure 6</a></figcaption></figure> +<figcaption><a href="#figure-7" class="selfRef">Figure 7</a></figcaption></figure> </div> <p id="section-4.1.1-11">where:<a href="#section-4.1.1-11" class="pilcrow">¶</a></p> <dl class="dlParallel" id="section-4.1.1-12"> <dt id="section-4.1.1-12.1">RR COUNT</dt> <dd id="section-4.1.1-12.2"> - A 32-bit value containing the number of resource records which are - following.<a href="#section-4.1.1-12.2" class="pilcrow">¶</a> + A 32-bit value containing the number of resource records which are + following.<a href="#section-4.1.1-12.2" class="pilcrow">¶</a> </dd> <dt id="section-4.1.1-12.3">RR</dt> <dd id="section-4.1.1-12.4"> - A set of resoure records as defined in <a href="#rrecords" class="xref">Section 3</a>.<a href="#section-4.1.1-12.4" class="pilcrow">¶</a> + A set of resoure records as defined in <a href="#rrecords" class="xref">Section 3</a>.<a href="#section-4.1.1-12.4" class="pilcrow">¶</a> </dd> </dl> </section> diff --git a/draft-schanzen-gns.txt b/draft-schanzen-gns.txt @@ -64,9 +64,9 @@ Table of Contents 2. Zones . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 3. Resource records . . . . . . . . . . . . . . . . . . . . . . 2 3.1. Flags . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 3.2. GNS resource record types . . . . . . . . . . . . . . . . 3 + 3.2. GNS resource record types . . . . . . . . . . . . . . . . 4 4. Publishing records . . . . . . . . . . . . . . . . . . . . . 4 - 4.1. Resource records block . . . . . . . . . . . . . . . . . 4 + 4.1. Resource records block . . . . . . . . . . . . . . . . . 5 4.1.1. Block data encryption . . . . . . . . . . . . . . . . 6 4.2. Internationalization and Character Encoding . . . . . . . 8 4.3. Security Considerations . . . . . . . . . . . . . . . . . 8 @@ -150,35 +150,51 @@ Internet-Draft The GNU Name System July 2019 3.1. Flags - TODO flags + Flags indicate metadata surrounding the resource record. A flag + value of 0 indicates that all flags are unset. The following + illustrates the flag distribution in the 32-bit flag value of a + resource record: -3.2. GNS resource record types + ... 5 4 3 2 1 0 + ------+--------+--------+--------+--------+--------+ + / ... | SHADOW | EXPREL | / | PRIVATE| / | + ------+--------+--------+--------+--------+--------+ - The a PKEY DATA entry has the following format: + Figure 2 +Schanzenbach Expires 24 January 2020 [Page 3] + +Internet-Draft The GNU Name System July 2019 + where: + SHADOW If this flag is set, this record should not be used unless + all (other) records with an absolute expiration time have expired. + EXPREL The expiration time value of the record is a relative time + and not an absolute time. This flag can be ignored by a resolver. + PRIVATE This is a private record of this peer and it should thus not + be handed out to other peers. This flag should never be + encountered by a resolver. -Schanzenbach Expires 24 January 2020 [Page 3] - -Internet-Draft The GNU Name System July 2019 +3.2. GNS resource record types + The a PKEY DATA entry has the following format: - 0 8 16 24 32 40 48 56 - +-----+-----+-----+-----+-----+-----+-----+-----+ - | PUBLIC KEY | - | | - | | - | | - +-----+-----+-----+-----+-----+-----+-----+-----+ + 0 8 16 24 32 40 48 56 + +-----+-----+-----+-----+-----+-----+-----+-----+ + | PUBLIC KEY | + | | + | | + | | + +-----+-----+-----+-----+-----+-----+-----+-----+ - Figure 2 + Figure 3 4. Publishing records @@ -189,9 +205,9 @@ Internet-Draft The GNU Name System July 2019 the contained records. Given a label "l", the DHT key "q" is derived as follows: - h := sha512 (l,y) - d := h*x mod p - q := sha512 (d*P) + h := HKDF ("key-derivation", l|y|"gns") + d := h*x mod p + q := sha512 (d*P) where: @@ -203,22 +219,6 @@ Internet-Draft The GNU Name System July 2019 published. It is the SHA512 hash over the public key "d*P" corresponding to the derived private key "d". -4.1. Resource records block - - GNS records are grouped by their labels are published as a single - block in the DHT. The contained resource records are encrypted using - a symmetric encryption scheme. A GNS resource records block has the - following format: - - - - - - - - - - Schanzenbach Expires 24 January 2020 [Page 4] @@ -226,32 +226,39 @@ Schanzenbach Expires 24 January 2020 [Page 4] Internet-Draft The GNU Name System July 2019 - 0 8 16 24 32 40 48 56 - +-----+-----+-----+-----+-----+-----+-----+-----+ - | SIGNATURE | - | | - | | - | | - | | - | | - | | - | | - +-----+-----+-----+-----+-----+-----+-----+-----+ - | PUBLIC KEY | - | | - | | - | | - +-----+-----+-----+-----+-----+-----+-----+-----+ - | BDATA SIZE | PURPOSE | - +-----+-----+-----+-----+-----+-----+-----+-----+ - | EXPIRATION | - +-----+-----+-----+-----+-----+-----+-----+-----+ - | BDATA / - / / - / | - +-----+-----+-----+-----+-----+-----+-----+-----+ +4.1. Resource records block - Figure 3 + GNS records are grouped by their labels are published as a single + block in the DHT. The contained resource records are encrypted using + a symmetric encryption scheme. A GNS resource records block has the + following format: + + 0 8 16 24 32 40 48 56 + +-----+-----+-----+-----+-----+-----+-----+-----+ + | SIGNATURE | + | | + | | + | | + | | + | | + | | + | | + +-----+-----+-----+-----+-----+-----+-----+-----+ + | PUBLIC KEY | + | | + | | + | | + +-----+-----+-----+-----+-----+-----+-----+-----+ + | BDATA SIZE | PURPOSE | + +-----+-----+-----+-----+-----+-----+-----+-----+ + | EXPIRATION | + +-----+-----+-----+-----+-----+-----+-----+-----+ + | BDATA / + / / + / | + +-----+-----+-----+-----+-----+-----+-----+-----+ + + Figure 4 where: @@ -268,13 +275,6 @@ Internet-Draft The GNU Name System July 2019 PURPOSE A 32-bit signature purpose flag. This field MUST be 15 (in network byte order). - EXPIRATION The resource records block expiration time. This is the - expiration time of the resource record contained within this block - with the smallest expiration time. This is a 64-bit absolute date - in microseconds since midnight (0 hour), January 1, 1970 in - network byte order. - - Schanzenbach Expires 24 January 2020 [Page 5] @@ -282,6 +282,12 @@ Schanzenbach Expires 24 January 2020 [Page 5] Internet-Draft The GNU Name System July 2019 + EXPIRATION The resource records block expiration time. This is the + expiration time of the resource record contained within this block + with the smallest expiration time. This is a 64-bit absolute date + in microseconds since midnight (0 hour), January 1, 1970 in + network byte order. + BDATA The encrypted resource records with a total size of "BDATA SIZE". @@ -295,10 +301,10 @@ Internet-Draft The GNU Name System July 2019 by the GNS resolver. The key material "K" and initialization vector "IV" are derived as follows: - h := HKDF ("key-derivation", l|y|"gns") - d := h*x mod p - K := HKDF (d*P, l|"gns-aes-ctx-key") - IV := HKDF (d*P, l|"gns-aes-ctx-iv") + h := HKDF ("key-derivation", l|y|"gns") + d := h*x mod p + K := HKDF (d*P, l|"gns-aes-ctx-key") + IV := HKDF (d*P, l|"gns-aes-ctx-iv") "HKDF" is a hash-based key derivation function as defined in [RFC5869]. We use HMAC-SHA512 for the extraction phase and HMAC- @@ -308,26 +314,20 @@ Internet-Draft The GNU Name System July 2019 resulting 512-bit "K" into a 256-bit AES key "Kaes" and a 256-bit TWOFISH key "Ktwo": - 0 8 16 24 32 40 48 56 - +-----+-----+-----+-----+-----+-----+-----+-----+ - | AES KEY (Kaes) | - | | - | | - | | - +-----+-----+-----+-----+-----+-----+-----+-----+ - | TWOFISH KEY (Ktwo) | - | | - | | - | | - +-----+-----+-----+-----+-----+-----+-----+-----+ - - Figure 4 - - Similarly, we divide "IV" into a 128-bit initialization vector IVaes - and a 128-bit initialization vector IVtwo: - - + 0 8 16 24 32 40 48 56 + +-----+-----+-----+-----+-----+-----+-----+-----+ + | AES KEY (Kaes) | + | | + | | + | | + +-----+-----+-----+-----+-----+-----+-----+-----+ + | TWOFISH KEY (Ktwo) | + | | + | | + | | + +-----+-----+-----+-----+-----+-----+-----+-----+ + Figure 5 @@ -338,54 +338,54 @@ Schanzenbach Expires 24 January 2020 [Page 6] Internet-Draft The GNU Name System July 2019 - 0 8 16 24 32 40 48 56 - +-----+-----+-----+-----+-----+-----+-----+-----+ - | AES IV (IVaes) | - | | - +-----+-----+-----+-----+-----+-----+-----+-----+ - | TWOFISH IV (IVtwo) | - | | - +-----+-----+-----+-----+-----+-----+-----+-----+ + Similarly, we divide "IV" into a 128-bit initialization vector IVaes + and a 128-bit initialization vector IVtwo: - Figure 5 + 0 8 16 24 32 40 48 56 + +-----+-----+-----+-----+-----+-----+-----+-----+ + | AES IV (IVaes) | + | | + +-----+-----+-----+-----+-----+-----+-----+-----+ + | TWOFISH IV (IVtwo) | + | | + +-----+-----+-----+-----+-----+-----+-----+-----+ + + Figure 6 The symmetric keys and IVs are used for a AES+TWOFISH combined cipher. Both ciphers are used in CFB (ref) mode. - RDATA := AES(Kaes, IVaes, TWOFISH(Ktwo, IVtwo, BDATA)) - BDATA := TWOFISH(Ktwo, IVtwo, AES(Kaes, IVaes, RDATA)) + RDATA := AES(Kaes, IVaes, TWOFISH(Ktwo, IVtwo, BDATA)) + BDATA := TWOFISH(Ktwo, IVtwo, AES(Kaes, IVaes, RDATA)) The decrypted RDATA has the following format: - 0 8 16 24 32 40 48 56 - +-----+-----+-----+-----+-----+-----+-----+-----+ - | RR COUNT | EXPIRA- / - +-----+-----+-----+-----+-----+-----+-----+-----+ - / -TION | DATA SIZE | - +-----+-----+-----+-----+-----+-----+-----+-----+ - | TYPE | FLAGS | - +-----+-----+-----+-----+-----+-----+-----+-----+ - | DATA / - / / - / | - +-----+-----+-----+-----+-----+-----+-----+-----+ - | EXPIRATION | - +-----+-----+-----+-----+-----+-----+-----+-----+ - | DATA SIZE | TYPE | - +-----+-----+-----+-----+-----+-----+-----+-----+ - | FLAGS | DATA / - +-----+-----+-----+-----+ / - / / - / / - / / + 0 8 16 24 32 40 48 56 + +-----+-----+-----+-----+-----+-----+-----+-----+ + | RR COUNT | EXPIRA- / + +-----+-----+-----+-----+-----+-----+-----+-----+ + / -TION | DATA SIZE | + +-----+-----+-----+-----+-----+-----+-----+-----+ + | TYPE | FLAGS | + +-----+-----+-----+-----+-----+-----+-----+-----+ + | DATA / + / / + / | + +-----+-----+-----+-----+-----+-----+-----+-----+ + | EXPIRATION | + +-----+-----+-----+-----+-----+-----+-----+-----+ + | DATA SIZE | TYPE | + +-----+-----+-----+-----+-----+-----+-----+-----+ + | FLAGS | DATA / + +-----+-----+-----+-----+ / + / / + / / + / / - Figure 6 + Figure 7 where: - RR COUNT A 32-bit value containing the number of resource records - which are following. - @@ -394,6 +394,9 @@ Schanzenbach Expires 24 January 2020 [Page 7] Internet-Draft The GNU Name System July 2019 + RR COUNT A 32-bit value containing the number of resource records + which are following. + RR A set of resoure records as defined in Section 3. 4.2. Internationalization and Character Encoding @@ -439,10 +442,63 @@ Author's Address 85748 Garching Germany + + + +Schanzenbach Expires 24 January 2020 [Page 8] + +Internet-Draft The GNU Name System July 2019 + + Email: schanzen@gnunet.org -Schanzenbach Expires 24 January 2020 [Page 8] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Schanzenbach Expires 24 January 2020 [Page 9] diff --git a/draft-schanzen-gns.xml b/draft-schanzen-gns.xml @@ -121,8 +121,41 @@ </dl> <section anchor="flags" numbered="true" toc="default"> <name>Flags</name> - - <t>TODO flags</t> + <t> + Flags indicate metadata surrounding the resource record. A flag + value of 0 indicates that all flags are unset. The following + illustrates the flag distribution in the 32-bit flag value of a + resource record:</t> + <figure anchor="figure_flag"> + <artwork name="" type="" align="left" alt=""><![CDATA[ + ... 5 4 3 2 1 0 + ------+--------+--------+--------+--------+--------+ + / ... | SHADOW | EXPREL | / | PRIVATE| / | + ------+--------+--------+--------+--------+--------+ + ]]></artwork> + <!-- <postamble>which is a very simple example.</postamble>--> + </figure> + <t> + where: + </t> + <dl> + <dt>SHADOW</dt> + <dd> + If this flag is set, this record should not be used unless all (other) + records with an absolute expiration time have expired. + </dd> + <dt>EXPREL</dt> + <dd> + The expiration time value of the record is a relative time and not + an absolute time. This flag can be ignored by a resolver. + </dd> + <dt>PRIVATE</dt> + <dd> + This is a private record of this peer and it should thus not be + handed out to other peers. This flag should never be encountered by + a resolver. + </dd> + </dl> </section> <section anchor="gnsrecords" numbered="true" toc="default"> <name>GNS resource record types</name> @@ -154,7 +187,7 @@ Given a label "l", the DHT key "q" is derived as follows: </t> <artwork name="" type="" align="left" alt=""><![CDATA[ - h := sha512 (l,y) + h := HKDF ("key-derivation", l|y|"gns") d := h*x mod p q := sha512 (d*P) ]]></artwork> @@ -348,18 +381,18 @@ ]]></artwork> <!-- <postamble>which is a very simple example.</postamble>--> </figure> - <t>where:</t> - <dl> - <dt>RR COUNT</dt> - <dd> - A 32-bit value containing the number of resource records which are - following. - </dd> - <dt>RR</dt> - <dd> - A set of resoure records as defined in <xref target="rrecords" />. - </dd> - </dl> + <t>where:</t> + <dl> + <dt>RR COUNT</dt> + <dd> + A 32-bit value containing the number of resource records which are + following. + </dd> + <dt>RR</dt> + <dd> + A set of resoure records as defined in <xref target="rrecords" />. + </dd> + </dl> </section> </section>