<?xml version='1.0' encoding='utf-8'?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" category="info" docName="draft-hallambaker-mesh-dare-18" indexInclude="false" ipr="trust200902" scripts="Common,Latin" sortRefs="true" submissionType="independent" symRefs="true" tocDepth="3" tocInclude="true" version="3" xml:lang="en"><front>
<title abbrev="Mesh: Data At Rest Encryption">Mathematical Mesh 3.0 Part III : Data At Rest Encryption (DARE)</title>
<seriesInfo name="draft-hallambaker-mesh-dare-18" value="draft-hallambaker-mesh-dare" stream="independent"/>
<author fullname="Phillip Hallam-Baker" initials="P. M." surname="Hallam-Baker"><organization>ThresholdSecrets.com</organization>
<address>
<email>phill@hallambaker.com</email>
</address>
</author>
<date day="14" month="October" year="2024"/>
<area/>
<workgroup/>
<abstract>
<t>This document describes the Data At Rest Encryption (DARE) Envelope and Sequence syntax. </t>
<t>The DARE Envelope syntax is used to digitally sign, digest, authenticate, or encrypt arbitrary content data.</t>
<t>The DARE Sequence syntax describes an append-only sequence of entries, each containing a DARE Envelope. DARE Sequences may support cryptographic integrity verification of the entire data container content by means of a Merkle tree. </t>
<t>[Note to Readers]</t>
<t>Discussion of this draft takes place on the MATHMESH mailing list (mathmesh@ietf.org), which is archived at https://mailarchive.ietf.org/arch/search/?email_list=mathmesh.</t>
<t>This document is also available online at <eref target="http://mathmesh.com/Documents/draft-hallambaker-mesh-dare.html"></eref>.</t>
</abstract>
</front>
<middle>
<section title="Introduction" anchor="n-introduction"><t>This document describes the Data At Rest Encryption (DARE) Envelope and Sequence Syntax. The DARE Envelope syntax is used to digitally sign, digest, authenticate, or encrypt arbitrary message content. The DARE Sequence syntax describes an append-only sequence of data frames, each containing a DARE Envelope that supports efficient incremental signature and encryption.</t>
<t>The DARE Envelope Syntax is based on a subset of the JSON Web Signature <xref target="RFC7515"></xref> and JSON Web Encryption <xref target="RFC7516"></xref> standards and shares many fields and semantics. The processing model and data structures have been streamlined to remove alternative means of specifying the same content and to enable multiple data sequences to be signed and encrypted under a single master encryption key without compromise to security.</t>
<t>A DARE Envelope consists of a <em>Header</em>, <em>Payload</em> and an optional <em>Trailer</em>. To enable single pass encoding and decoding, the Header contains all the information required to perform cryptographic processing of the Payload and authentication data (digest, MAC, signature values) <bcp14>MAY</bcp14> be deferred to the Trailer section.</t>
<t>A DARE Sequence is an append-only log format consisting of a sequence of frames. Cryptographic enhancements (signature, encryption) may be applied to individual frames or to sets of frames. Thus, a single key exchange may be used to provide a master key to encrypt multiple frames and a single signature may be used to authenticate all the frames in the container up to and including the frame in which the signature is presented.</t>
<t>The DARE Envelope syntax may be used either as a standalone cryptographic message syntax or as a means of presenting a single DARE Sequence frame together with the complete cryptographic context required to verify the contents and decrypt them.</t>
<section title="Encryption and Integrity" anchor="n-encryption-and-integrity"><t>A key innovation in the DARE Envelope Syntax is the separation of key exchange and data encryption operations so that a Master Key (MK) established in a single exchange to be applied to multiple data sequences. This means that a single public key operation <bcp14>MAY</bcp14> be used to encrypt and/or authenticate multiple parts of the same DARE Envelope or multiple frames in a DARE Sequence.</t>
<t>To avoid reuse of the key and to avoid the need to communicate separate IVs, each octet sequence is encrypted under a different encryption key (and IV if required) derived from the Master Key by means of a salt that is unique for each octet sequence that is encrypted. The same approach is used to generate keys for calculating a MAC over the octet sequence if required. This approach allows encryption and integrity protections to be applied to the envelope payload, to header or trailer fields or to application defined Enhanced Data Sequences in the header or trailer. </t>
<section title="Key Exchange" anchor="n-key-exchange"><t>Traditional cryptographic containers describe the application of a single key exchange to encryption of a single octet sequence. Examples include PCKS#7/CMS <xref target="RFC2315"></xref>, OpenPGP <xref target="RFC4880"></xref> and JSON Web Encryption <xref target="RFC7516"></xref>.</t>
<t>To encrypt data using RSA, the encoder first generates a random encryption key and initialization vector (IV). The encryption key is encrypted under the public key of each recipient to create a per-recipient decryption entry. The encryption key, plaintext and IV are used to generate the ciphertext (figure 1).</t>
<figure>
<name>
Monolithic Key Exchange and Encrypt</name>
<!-- Include SVG File ../Images/DAREEncrypt1.svg --><artwork type="svg">
<svg width="552" height="345" xmlns="http://www.w3.org/2000/svg" >
<g transform="translate(8,16)">
  <path d="M 0,0 L 120,0" fill="none" stroke="black" />
  <path d="M 416,0 L 536,0" fill="none" stroke="black" />
  <path d="M 120,16 L 264,16" fill="none" stroke="black" />
  <path d="M 264,16 L 408,16" fill="none" stroke="black" />
  <path d="M 0,48 L 120,48" fill="none" stroke="black" />
  <path d="M 416,48 L 536,48" fill="none" stroke="black" />
  <path d="M 0,96 L 120,96" fill="none" stroke="black" />
  <path d="M 208,96 L 328,96" fill="none" stroke="black" />
  <path d="M 416,96 L 536,96" fill="none" stroke="black" />
  <path d="M 120,112 L 160,112" fill="none" stroke="black" />
  <path d="M 160,112 L 200,112" fill="none" stroke="black" />
  <path d="M 328,112 L 408,112" fill="none" stroke="black" />
  <path d="M 0,144 L 120,144" fill="none" stroke="black" />
  <path d="M 208,144 L 328,144" fill="none" stroke="black" />
  <path d="M 416,144 L 536,144" fill="none" stroke="black" />
  <path d="M 0,176 L 120,176" fill="none" stroke="black" />
  <path d="M 208,176 L 328,176" fill="none" stroke="black" />
  <path d="M 416,176 L 536,176" fill="none" stroke="black" />
  <path d="M 160,192 L 200,192" fill="none" stroke="black" />
  <path d="M 120,208 L 200,208" fill="none" stroke="black" />
  <path d="M 328,208 L 408,208" fill="none" stroke="black" />
  <path d="M 160,224 L 200,224" fill="none" stroke="black" />
  <path d="M 0,240 L 120,240" fill="none" stroke="black" />
  <path d="M 208,240 L 328,240" fill="none" stroke="black" />
  <path d="M 416,240 L 536,240" fill="none" stroke="black" />
  <path d="M 0,272 L 120,272" fill="none" stroke="black" />
  <path d="M 416,272 L 536,272" fill="none" stroke="black" />
  <path d="M 120,288 L 160,288" fill="none" stroke="black" />
  <path d="M 160,288 L 408,288" fill="none" stroke="black" />
  <path d="M 0,320 L 120,320" fill="none" stroke="black" />
  <path d="M 416,320 L 536,320" fill="none" stroke="black" />
  <path d="M 0,0 L 0,48" fill="none" stroke="black" />
  <path d="M 0,96 L 0,144" fill="none" stroke="black" />
  <path d="M 0,176 L 0,240" fill="none" stroke="black" />
  <path d="M 0,272 L 0,320" fill="none" stroke="black" />
  <path d="M 120,0 L 120,16" fill="none" stroke="black" />
  <path d="M 120,16 L 120,48" fill="none" stroke="black" />
  <path d="M 120,96 L 120,112" fill="none" stroke="black" />
  <path d="M 120,112 L 120,144" fill="none" stroke="black" />
  <path d="M 120,176 L 120,208" fill="none" stroke="black" />
  <path d="M 120,208 L 120,240" fill="none" stroke="black" />
  <path d="M 120,272 L 120,288" fill="none" stroke="black" />
  <path d="M 120,288 L 120,320" fill="none" stroke="black" />
  <path d="M 160,112 L 160,192" fill="none" stroke="black" />
  <path d="M 160,224 L 160,288" fill="none" stroke="black" />
  <path d="M 208,96 L 208,144" fill="none" stroke="black" />
  <path d="M 208,176 L 208,240" fill="none" stroke="black" />
  <path d="M 264,16 L 264,80" fill="none" stroke="black" />
  <path d="M 328,96 L 328,112" fill="none" stroke="black" />
  <path d="M 328,112 L 328,144" fill="none" stroke="black" />
  <path d="M 328,176 L 328,208" fill="none" stroke="black" />
  <path d="M 328,208 L 328,240" fill="none" stroke="black" />
  <path d="M 416,0 L 416,48" fill="none" stroke="black" />
  <path d="M 416,96 L 416,144" fill="none" stroke="black" />
  <path d="M 416,176 L 416,240" fill="none" stroke="black" />
  <path d="M 416,272 L 416,320" fill="none" stroke="black" />
  <path d="M 536,0 L 536,48" fill="none" stroke="black" />
  <path d="M 536,96 L 536,144" fill="none" stroke="black" />
  <path d="M 536,176 L 536,240" fill="none" stroke="black" />
  <path d="M 536,272 L 536,320" fill="none" stroke="black" />
  <polygon points="208.000000,112.000000 196.000000,106.400002 196.000000,117.599998" fill="black" transform="rotate(0.000000, 200.000000, 112.000000)" />
  <polygon points="208.000000,192.000000 196.000000,186.399994 196.000000,197.600006" fill="black" transform="rotate(0.000000, 200.000000, 192.000000)" />
  <polygon points="208.000000,208.000000 196.000000,202.399994 196.000000,213.600006" fill="black" transform="rotate(0.000000, 200.000000, 208.000000)" />
  <polygon points="208.000000,224.000000 196.000000,218.399994 196.000000,229.600006" fill="black" transform="rotate(0.000000, 200.000000, 224.000000)" />
  <path d="M 264,80 L 264,88" fill="none" stroke="black" />
  <polygon points="280.000000,80.000000 268.000000,74.400002 268.000000,85.599998" fill="black" transform="rotate(90.000000, 264.000000, 80.000000)" />
  <polygon points="416.000000,16.000000 404.000000,10.400000 404.000000,21.600000" fill="black" transform="rotate(0.000000, 408.000000, 16.000000)" />
  <polygon points="416.000000,112.000000 404.000000,106.400002 404.000000,117.599998" fill="black" transform="rotate(0.000000, 408.000000, 112.000000)" />
  <polygon points="416.000000,208.000000 404.000000,202.399994 404.000000,213.600006" fill="black" transform="rotate(0.000000, 408.000000, 208.000000)" />
  <polygon points="416.000000,288.000000 404.000000,282.399994 404.000000,293.600006" fill="black" transform="rotate(0.000000, 408.000000, 288.000000)" />
  <text text-anchor="middle" font-family="sans-serif" x="72" y="20">K</text>
  <text text-anchor="middle" font-family="sans-serif" x="16" y="36">I</text>
  <text text-anchor="middle" font-family="sans-serif" x="480" y="36">f</text>
  <text text-anchor="middle" font-family="sans-serif" x="264" y="116">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="440" y="212">C</text>
  <text text-anchor="middle" font-family="sans-serif" x="456" y="212">p</text>
  <text text-anchor="middle" font-family="sans-serif" x="96" y="292">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="24" y="20">u</text>
  <text text-anchor="middle" font-family="sans-serif" x="24" y="116">E</text>
  <text text-anchor="middle" font-family="sans-serif" x="264" y="132">h</text>
  <text text-anchor="middle" font-family="sans-serif" x="264" y="196">r</text>
  <text text-anchor="middle" font-family="sans-serif" x="40" y="212">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="240" y="228">y</text>
  <text text-anchor="middle" font-family="sans-serif" x="440" y="292">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="464" y="20">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="256" y="116">K</text>
  <text text-anchor="middle" font-family="sans-serif" x="464" y="116">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="56" y="212">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="480" y="212">r</text>
  <text text-anchor="middle" font-family="sans-serif" x="32" y="292">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="432" y="292">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="520" y="292">o</text>
  <text text-anchor="middle" font-family="sans-serif" x="72" y="308">o</text>
  <text text-anchor="middle" font-family="sans-serif" x="496" y="308">r</text>
  <text text-anchor="middle" font-family="sans-serif" x="64" y="36">a</text>
  <text text-anchor="middle" font-family="sans-serif" x="448" y="36">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="72" y="116">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="472" y="212">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="424" y="292">I</text>
  <text text-anchor="middle" font-family="sans-serif" x="496" y="292">a</text>
  <text text-anchor="middle" font-family="sans-serif" x="96" y="116">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="80" y="212">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="504" y="292">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="32" y="36">f</text>
  <text text-anchor="middle" font-family="sans-serif" x="464" y="36">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="240" y="196">E</text>
  <text text-anchor="middle" font-family="sans-serif" x="16" y="212">P</text>
  <text text-anchor="middle" font-family="sans-serif" x="72" y="292">z</text>
  <text text-anchor="middle" font-family="sans-serif" x="480" y="116">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="24" y="212">l</text>
  <text text-anchor="middle" font-family="sans-serif" x="48" y="212">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="296" y="228">c</text>
  <text text-anchor="middle" font-family="sans-serif" x="48" y="116">r</text>
  <text text-anchor="middle" font-family="sans-serif" x="496" y="116">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="72" y="212">x</text>
  <text text-anchor="middle" font-family="sans-serif" x="8" y="292">I</text>
  <text text-anchor="middle" font-family="sans-serif" x="464" y="292">a</text>
  <text text-anchor="middle" font-family="sans-serif" x="488" y="36">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="32" y="116">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="264" y="228">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="80" y="308">r</text>
  <text text-anchor="middle" font-family="sans-serif" x="64" y="116">p</text>
  <text text-anchor="middle" font-family="sans-serif" x="288" y="132">g</text>
  <text text-anchor="middle" font-family="sans-serif" x="448" y="292">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="472" y="20">c</text>
  <text text-anchor="middle" font-family="sans-serif" x="448" y="116">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="64" y="132">y</text>
  <text text-anchor="middle" font-family="sans-serif" x="240" y="132">E</text>
  <text text-anchor="middle" font-family="sans-serif" x="432" y="132">I</text>
  <text text-anchor="middle" font-family="sans-serif" x="464" y="132">r</text>
  <text text-anchor="middle" font-family="sans-serif" x="16" y="292">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="80" y="20">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="88" y="20">y</text>
  <text text-anchor="middle" font-family="sans-serif" x="432" y="20">P</text>
  <text text-anchor="middle" font-family="sans-serif" x="248" y="132">x</text>
  <text text-anchor="middle" font-family="sans-serif" x="480" y="132">a</text>
  <text text-anchor="middle" font-family="sans-serif" x="288" y="196">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="528" y="292">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="72" y="36">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="256" y="196">c</text>
  <text text-anchor="middle" font-family="sans-serif" x="272" y="228">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="88" y="292">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="48" y="308">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="56" y="36">m</text>
  <text text-anchor="middle" font-family="sans-serif" x="440" y="36">d</text>
  <text text-anchor="middle" font-family="sans-serif" x="472" y="36">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="224" y="228">(</text>
  <text text-anchor="middle" font-family="sans-serif" x="288" y="228">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="456" y="20">l</text>
  <text text-anchor="middle" font-family="sans-serif" x="40" y="36">o</text>
  <text text-anchor="middle" font-family="sans-serif" x="40" y="116">c</text>
  <text text-anchor="middle" font-family="sans-serif" x="280" y="196">p</text>
  <text text-anchor="middle" font-family="sans-serif" x="24" y="292">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="480" y="308">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="96" y="36">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="432" y="36">I</text>
  <text text-anchor="middle" font-family="sans-serif" x="504" y="116">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="32" y="20">b</text>
  <text text-anchor="middle" font-family="sans-serif" x="48" y="20">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="456" y="36">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="80" y="116">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="472" y="116">p</text>
  <text text-anchor="middle" font-family="sans-serif" x="456" y="132">o</text>
  <text text-anchor="middle" font-family="sans-serif" x="104" y="292">o</text>
  <text text-anchor="middle" font-family="sans-serif" x="480" y="292">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="64" y="308">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="504" y="20">y</text>
  <text text-anchor="middle" font-family="sans-serif" x="56" y="116">y</text>
  <text text-anchor="middle" font-family="sans-serif" x="440" y="132">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="248" y="228">m</text>
  <text text-anchor="middle" font-family="sans-serif" x="80" y="292">a</text>
  <text text-anchor="middle" font-family="sans-serif" x="504" y="212">x</text>
  <text text-anchor="middle" font-family="sans-serif" x="472" y="292">l</text>
  <text text-anchor="middle" font-family="sans-serif" x="512" y="292">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="448" y="20">b</text>
  <text text-anchor="middle" font-family="sans-serif" x="448" y="132">f</text>
  <text text-anchor="middle" font-family="sans-serif" x="496" y="212">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="512" y="212">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="88" y="36">o</text>
  <text text-anchor="middle" font-family="sans-serif" x="88" y="116">o</text>
  <text text-anchor="middle" font-family="sans-serif" x="472" y="132">m</text>
  <text text-anchor="middle" font-family="sans-serif" x="496" y="20">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="24" y="36">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="48" y="36">r</text>
  <text text-anchor="middle" font-family="sans-serif" x="504" y="36">r</text>
  <text text-anchor="middle" font-family="sans-serif" x="456" y="116">c</text>
  <text text-anchor="middle" font-family="sans-serif" x="464" y="212">h</text>
  <text text-anchor="middle" font-family="sans-serif" x="488" y="292">z</text>
  <text text-anchor="middle" font-family="sans-serif" x="16" y="20">P</text>
  <text text-anchor="middle" font-family="sans-serif" x="440" y="116">R</text>
  <text text-anchor="middle" font-family="sans-serif" x="56" y="132">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="280" y="132">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="448" y="212">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="56" y="292">l</text>
  <text text-anchor="middle" font-family="sans-serif" x="56" y="308">c</text>
  <text text-anchor="middle" font-family="sans-serif" x="440" y="20">u</text>
  <text text-anchor="middle" font-family="sans-serif" x="272" y="196">y</text>
  <text text-anchor="middle" font-family="sans-serif" x="488" y="212">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="48" y="292">a</text>
  <text text-anchor="middle" font-family="sans-serif" x="456" y="292">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="40" y="20">l</text>
  <text text-anchor="middle" font-family="sans-serif" x="488" y="20">K</text>
  <text text-anchor="middle" font-family="sans-serif" x="80" y="36">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="272" y="116">y</text>
  <text text-anchor="middle" font-family="sans-serif" x="296" y="132">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="488" y="132">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="496" y="132">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="504" y="132">o</text>
  <text text-anchor="middle" font-family="sans-serif" x="512" y="132">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="64" y="212">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="472" y="308">c</text>
  <text text-anchor="middle" font-family="sans-serif" x="56" y="20">c</text>
  <text text-anchor="middle" font-family="sans-serif" x="456" y="308">V</text>
  <text text-anchor="middle" font-family="sans-serif" x="488" y="116">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="248" y="196">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="40" y="292">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="64" y="292">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="40" y="308">V</text>
  <text text-anchor="middle" font-family="sans-serif" x="488" y="308">o</text>
  <text text-anchor="middle" font-family="sans-serif" x="256" y="132">c</text>
  <text text-anchor="middle" font-family="sans-serif" x="232" y="228">S</text>
  <text text-anchor="middle" font-family="sans-serif" x="280" y="228">r</text>
  <text text-anchor="middle" font-family="sans-serif" x="112" y="292">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="496" y="36">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="48" y="132">K</text>
  <text text-anchor="middle" font-family="sans-serif" x="272" y="132">a</text>
  <text text-anchor="middle" font-family="sans-serif" x="32" y="212">a</text>
  <text text-anchor="middle" font-family="sans-serif" x="256" y="228">m</text>
  <text text-anchor="middle" font-family="sans-serif" x="304" y="228">)</text>
  <text text-anchor="middle" font-family="sans-serif" x="464" y="308">e</text>
</g></svg>
</artwork>
</figure>
<t>This approach is adequate for the task of encrypting a single octet stream. It is less than satisfactory when encrypting multiple octet streams or very long streams for which a rekeying operation is desirable. </t>
<t>In the DARE approach, key exchange and key derivation are separate operations and keys <bcp14>MAY</bcp14> be derived for encryption or integrity purposes or both. A single key exchange <bcp14>MAY</bcp14> be used to derive keys to apply encryption and integrity enhancements to multiple data sequences.</t>
<t>The DARE key exchange begins with the same key exchange used to produce the CEK in JWE but instead of using the CEK to encipher data directly, it is used as one of the inputs to a Key Derivation Function (KDF) that is used to derive parameters for each block of data to be encrypted. To avoid the need to introduce additional terminology, the term 'CEK' is still used to describe the output of the key agreement algorithm (including key unwrapping if required) but it is more appropriately described as a Master Key (figure 2).</t>
<figure>
<name>
Exchange of Master Key</name>
<!-- Include SVG File ../Images/DAREEncrypt2.svg --><artwork type="svg">
<svg width="552" height="281" xmlns="http://www.w3.org/2000/svg" >
<g transform="translate(8,16)">
  <path d="M 0,0 L 120,0" fill="none" stroke="black" />
  <path d="M 416,0 L 536,0" fill="none" stroke="black" />
  <path d="M 120,16 L 264,16" fill="none" stroke="black" />
  <path d="M 264,16 L 408,16" fill="none" stroke="black" />
  <path d="M 0,48 L 120,48" fill="none" stroke="black" />
  <path d="M 416,48 L 536,48" fill="none" stroke="black" />
  <path d="M 208,96 L 328,96" fill="none" stroke="black" />
  <path d="M 208,144 L 264,144" fill="none" stroke="black" />
  <path d="M 264,144 L 328,144" fill="none" stroke="black" />
  <path d="M 208,208 L 328,208" fill="none" stroke="black" />
  <path d="M 208,256 L 328,256" fill="none" stroke="black" />
  <path d="M 0,0 L 0,48" fill="none" stroke="black" />
  <path d="M 120,0 L 120,16" fill="none" stroke="black" />
  <path d="M 120,16 L 120,48" fill="none" stroke="black" />
  <path d="M 208,96 L 208,144" fill="none" stroke="black" />
  <path d="M 208,208 L 208,256" fill="none" stroke="black" />
  <path d="M 264,16 L 264,80" fill="none" stroke="black" />
  <path d="M 264,144 L 264,192" fill="none" stroke="black" />
  <path d="M 328,96 L 328,112" fill="none" stroke="black" />
  <path d="M 328,112 L 328,144" fill="none" stroke="black" />
  <path d="M 328,208 L 328,256" fill="none" stroke="black" />
  <path d="M 416,0 L 416,48" fill="none" stroke="black" />
  <path d="M 536,0 L 536,48" fill="none" stroke="black" />
  <path d="M 264,80 L 264,88" fill="none" stroke="black" />
  <polygon points="280.000000,80.000000 268.000000,74.400002 268.000000,85.599998" fill="black" transform="rotate(90.000000, 264.000000, 80.000000)" />
  <path d="M 264,192 L 264,200" fill="none" stroke="black" />
  <polygon points="280.000000,192.000000 268.000000,186.399994 268.000000,197.600006" fill="black" transform="rotate(90.000000, 264.000000, 192.000000)" />
  <polygon points="416.000000,16.000000 404.000000,10.400000 404.000000,21.600000" fill="black" transform="rotate(0.000000, 408.000000, 16.000000)" />
  <text text-anchor="middle" font-family="sans-serif" x="16" y="20">P</text>
  <text text-anchor="middle" font-family="sans-serif" x="440" y="36">d</text>
  <text text-anchor="middle" font-family="sans-serif" x="296" y="132">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="48" y="20">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="16" y="36">I</text>
  <text text-anchor="middle" font-family="sans-serif" x="72" y="36">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="248" y="132">x</text>
  <text text-anchor="middle" font-family="sans-serif" x="288" y="132">g</text>
  <text text-anchor="middle" font-family="sans-serif" x="280" y="228">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="40" y="20">l</text>
  <text text-anchor="middle" font-family="sans-serif" x="456" y="36">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="256" y="244">K</text>
  <text text-anchor="middle" font-family="sans-serif" x="88" y="36">o</text>
  <text text-anchor="middle" font-family="sans-serif" x="264" y="116">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="240" y="132">E</text>
  <text text-anchor="middle" font-family="sans-serif" x="272" y="132">a</text>
  <text text-anchor="middle" font-family="sans-serif" x="280" y="132">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="464" y="20">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="472" y="36">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="440" y="20">u</text>
  <text text-anchor="middle" font-family="sans-serif" x="504" y="20">y</text>
  <text text-anchor="middle" font-family="sans-serif" x="72" y="20">K</text>
  <text text-anchor="middle" font-family="sans-serif" x="472" y="20">c</text>
  <text text-anchor="middle" font-family="sans-serif" x="488" y="20">K</text>
  <text text-anchor="middle" font-family="sans-serif" x="496" y="36">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="272" y="244">y</text>
  <text text-anchor="middle" font-family="sans-serif" x="56" y="20">c</text>
  <text text-anchor="middle" font-family="sans-serif" x="496" y="20">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="256" y="132">c</text>
  <text text-anchor="middle" font-family="sans-serif" x="248" y="228">M</text>
  <text text-anchor="middle" font-family="sans-serif" x="288" y="228">r</text>
  <text text-anchor="middle" font-family="sans-serif" x="56" y="36">m</text>
  <text text-anchor="middle" font-family="sans-serif" x="448" y="36">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="32" y="36">f</text>
  <text text-anchor="middle" font-family="sans-serif" x="40" y="36">o</text>
  <text text-anchor="middle" font-family="sans-serif" x="48" y="36">r</text>
  <text text-anchor="middle" font-family="sans-serif" x="80" y="20">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="24" y="36">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="96" y="36">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="464" y="36">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="504" y="36">r</text>
  <text text-anchor="middle" font-family="sans-serif" x="272" y="228">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="264" y="228">s</text>
  <text text-anchor="middle" font-family="sans-serif" x="264" y="244">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="32" y="20">b</text>
  <text text-anchor="middle" font-family="sans-serif" x="448" y="20">b</text>
  <text text-anchor="middle" font-family="sans-serif" x="80" y="36">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="480" y="36">f</text>
  <text text-anchor="middle" font-family="sans-serif" x="256" y="116">K</text>
  <text text-anchor="middle" font-family="sans-serif" x="272" y="116">y</text>
  <text text-anchor="middle" font-family="sans-serif" x="64" y="36">a</text>
  <text text-anchor="middle" font-family="sans-serif" x="432" y="36">I</text>
  <text text-anchor="middle" font-family="sans-serif" x="456" y="20">l</text>
  <text text-anchor="middle" font-family="sans-serif" x="24" y="20">u</text>
  <text text-anchor="middle" font-family="sans-serif" x="88" y="20">y</text>
  <text text-anchor="middle" font-family="sans-serif" x="432" y="20">P</text>
  <text text-anchor="middle" font-family="sans-serif" x="488" y="36">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="264" y="132">h</text>
  <text text-anchor="middle" font-family="sans-serif" x="256" y="228">a</text>
</g></svg>
</artwork>
</figure>
<t>A Master Key may be used to encrypt any number of data items. Each data item is encrypted under a different encryption key and IV (if required). This data is derived from the Master Key using the HKDF function <xref target="RFC5869"></xref> using a different salt for each data item and separate info tags for each cryptographic function (figure 3).</t>
<figure>
<name>
Data item encryption under Master Key and per-item salt.</name>
<!-- Include SVG File ../Images/DAREEncrypt3.svg --><artwork type="svg">
<svg width="552" height="457" xmlns="http://www.w3.org/2000/svg" >
<g transform="translate(8,16)">
  <path d="M 208,0 L 328,0" fill="none" stroke="black" />
  <path d="M 208,48 L 264,48" fill="none" stroke="black" />
  <path d="M 264,48 L 328,48" fill="none" stroke="black" />
  <path d="M 208,96 L 328,96" fill="none" stroke="black" />
  <path d="M 0,112 L 120,112" fill="none" stroke="black" />
  <path d="M 120,128 L 160,128" fill="none" stroke="black" />
  <path d="M 160,128 L 200,128" fill="none" stroke="black" />
  <path d="M 0,144 L 120,144" fill="none" stroke="black" />
  <path d="M 208,160 L 256,160" fill="none" stroke="black" />
  <path d="M 256,160 L 280,160" fill="none" stroke="black" />
  <path d="M 280,160 L 328,160" fill="none" stroke="black" />
  <path d="M 192,192 L 256,192" fill="none" stroke="black" />
  <path d="M 280,192 L 336,192" fill="none" stroke="black" />
  <path d="M 136,240 L 256,240" fill="none" stroke="black" />
  <path d="M 280,240 L 400,240" fill="none" stroke="black" />
  <path d="M 136,288 L 192,288" fill="none" stroke="black" />
  <path d="M 192,288 L 256,288" fill="none" stroke="black" />
  <path d="M 280,288 L 336,288" fill="none" stroke="black" />
  <path d="M 336,288 L 400,288" fill="none" stroke="black" />
  <path d="M 192,320 L 256,320" fill="none" stroke="black" />
  <path d="M 280,320 L 336,320" fill="none" stroke="black" />
  <path d="M 0,368 L 120,368" fill="none" stroke="black" />
  <path d="M 208,368 L 328,368" fill="none" stroke="black" />
  <path d="M 416,368 L 536,368" fill="none" stroke="black" />
  <path d="M 120,400 L 200,400" fill="none" stroke="black" />
  <path d="M 328,400 L 408,400" fill="none" stroke="black" />
  <path d="M 0,432 L 120,432" fill="none" stroke="black" />
  <path d="M 208,432 L 328,432" fill="none" stroke="black" />
  <path d="M 416,432 L 536,432" fill="none" stroke="black" />
  <path d="M 0,112 L 0,144" fill="none" stroke="black" />
  <path d="M 0,368 L 0,432" fill="none" stroke="black" />
  <path d="M 120,112 L 120,128" fill="none" stroke="black" />
  <path d="M 120,128 L 120,144" fill="none" stroke="black" />
  <path d="M 120,368 L 120,400" fill="none" stroke="black" />
  <path d="M 120,400 L 120,432" fill="none" stroke="black" />
  <path d="M 136,240 L 136,288" fill="none" stroke="black" />
  <path d="M 192,192 L 192,224" fill="none" stroke="black" />
  <path d="M 192,288 L 192,320" fill="none" stroke="black" />
  <path d="M 208,0 L 208,48" fill="none" stroke="black" />
  <path d="M 208,96 L 208,160" fill="none" stroke="black" />
  <path d="M 208,368 L 208,432" fill="none" stroke="black" />
  <path d="M 256,160 L 256,192" fill="none" stroke="black" />
  <path d="M 256,240 L 256,288" fill="none" stroke="black" />
  <path d="M 256,320 L 256,352" fill="none" stroke="black" />
  <path d="M 264,48 L 264,80" fill="none" stroke="black" />
  <path d="M 280,160 L 280,192" fill="none" stroke="black" />
  <path d="M 280,240 L 280,288" fill="none" stroke="black" />
  <path d="M 280,320 L 280,352" fill="none" stroke="black" />
  <path d="M 328,0 L 328,48" fill="none" stroke="black" />
  <path d="M 328,96 L 328,160" fill="none" stroke="black" />
  <path d="M 328,368 L 328,400" fill="none" stroke="black" />
  <path d="M 328,400 L 328,432" fill="none" stroke="black" />
  <path d="M 336,192 L 336,224" fill="none" stroke="black" />
  <path d="M 336,288 L 336,320" fill="none" stroke="black" />
  <path d="M 400,240 L 400,288" fill="none" stroke="black" />
  <path d="M 416,368 L 416,432" fill="none" stroke="black" />
  <path d="M 536,368 L 536,432" fill="none" stroke="black" />
  <path d="M 192,224 L 192,232" fill="none" stroke="black" />
  <polygon points="208.000000,224.000000 196.000000,218.399994 196.000000,229.600006" fill="black" transform="rotate(90.000000, 192.000000, 224.000000)" />
  <polygon points="208.000000,128.000000 196.000000,122.400002 196.000000,133.600006" fill="black" transform="rotate(0.000000, 200.000000, 128.000000)" />
  <polygon points="208.000000,400.000000 196.000000,394.399994 196.000000,405.600006" fill="black" transform="rotate(0.000000, 200.000000, 400.000000)" />
  <path d="M 256,352 L 256,360" fill="none" stroke="black" />
  <polygon points="272.000000,352.000000 260.000000,346.399994 260.000000,357.600006" fill="black" transform="rotate(90.000000, 256.000000, 352.000000)" />
  <path d="M 264,80 L 264,88" fill="none" stroke="black" />
  <polygon points="280.000000,80.000000 268.000000,74.400002 268.000000,85.599998" fill="black" transform="rotate(90.000000, 264.000000, 80.000000)" />
  <path d="M 280,352 L 280,360" fill="none" stroke="black" />
  <polygon points="296.000000,352.000000 284.000000,346.399994 284.000000,357.600006" fill="black" transform="rotate(90.000000, 280.000000, 352.000000)" />
  <path d="M 336,224 L 336,232" fill="none" stroke="black" />
  <polygon points="352.000000,224.000000 340.000000,218.399994 340.000000,229.600006" fill="black" transform="rotate(90.000000, 336.000000, 224.000000)" />
  <polygon points="416.000000,400.000000 404.000000,394.399994 404.000000,405.600006" fill="black" transform="rotate(0.000000, 408.000000, 400.000000)" />
  <text text-anchor="middle" font-family="sans-serif" x="200" y="260">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="240" y="132">r</text>
  <text text-anchor="middle" font-family="sans-serif" x="248" y="132">r</text>
  <text text-anchor="middle" font-family="sans-serif" x="168" y="260">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="200" y="276">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="224" y="420">(</text>
  <text text-anchor="middle" font-family="sans-serif" x="296" y="420">c</text>
  <text text-anchor="middle" font-family="sans-serif" x="264" y="420">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="248" y="20">M</text>
  <text text-anchor="middle" font-family="sans-serif" x="376" y="260">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="176" y="276">V</text>
  <text text-anchor="middle" font-family="sans-serif" x="216" y="276">r</text>
  <text text-anchor="middle" font-family="sans-serif" x="272" y="36">y</text>
  <text text-anchor="middle" font-family="sans-serif" x="192" y="260">l</text>
  <text text-anchor="middle" font-family="sans-serif" x="352" y="260">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="464" y="404">h</text>
  <text text-anchor="middle" font-family="sans-serif" x="272" y="20">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="280" y="420">r</text>
  <text text-anchor="middle" font-family="sans-serif" x="248" y="388">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="288" y="388">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="256" y="36">K</text>
  <text text-anchor="middle" font-family="sans-serif" x="48" y="132">S</text>
  <text text-anchor="middle" font-family="sans-serif" x="320" y="260">c</text>
  <text text-anchor="middle" font-family="sans-serif" x="360" y="260">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="336" y="276">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="264" y="388">r</text>
  <text text-anchor="middle" font-family="sans-serif" x="256" y="132">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="152" y="260">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="184" y="260">a</text>
  <text text-anchor="middle" font-family="sans-serif" x="48" y="404">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="80" y="404">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="232" y="420">S</text>
  <text text-anchor="middle" font-family="sans-serif" x="240" y="260">o</text>
  <text text-anchor="middle" font-family="sans-serif" x="24" y="404">l</text>
  <text text-anchor="middle" font-family="sans-serif" x="248" y="420">m</text>
  <text text-anchor="middle" font-family="sans-serif" x="32" y="404">a</text>
  <text text-anchor="middle" font-family="sans-serif" x="160" y="260">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="232" y="260">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="344" y="260">p</text>
  <text text-anchor="middle" font-family="sans-serif" x="40" y="404">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="232" y="132">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="264" y="132">v</text>
  <text text-anchor="middle" font-family="sans-serif" x="280" y="148">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="272" y="420">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="280" y="388">p</text>
  <text text-anchor="middle" font-family="sans-serif" x="512" y="404">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="304" y="132">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="272" y="148">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="192" y="276">c</text>
  <text text-anchor="middle" font-family="sans-serif" x="16" y="404">P</text>
  <text text-anchor="middle" font-family="sans-serif" x="368" y="260">o</text>
  <text text-anchor="middle" font-family="sans-serif" x="224" y="260">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="264" y="148">c</text>
  <text text-anchor="middle" font-family="sans-serif" x="208" y="260">z</text>
  <text text-anchor="middle" font-family="sans-serif" x="240" y="388">E</text>
  <text text-anchor="middle" font-family="sans-serif" x="256" y="20">a</text>
  <text text-anchor="middle" font-family="sans-serif" x="288" y="132">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="440" y="404">C</text>
  <text text-anchor="middle" font-family="sans-serif" x="256" y="420">m</text>
  <text text-anchor="middle" font-family="sans-serif" x="208" y="276">o</text>
  <text text-anchor="middle" font-family="sans-serif" x="272" y="132">a</text>
  <text text-anchor="middle" font-family="sans-serif" x="240" y="148">F</text>
  <text text-anchor="middle" font-family="sans-serif" x="216" y="260">a</text>
  <text text-anchor="middle" font-family="sans-serif" x="184" y="276">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="296" y="148">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="328" y="260">r</text>
  <text text-anchor="middle" font-family="sans-serif" x="56" y="132">a</text>
  <text text-anchor="middle" font-family="sans-serif" x="64" y="132">l</text>
  <text text-anchor="middle" font-family="sans-serif" x="144" y="260">I</text>
  <text text-anchor="middle" font-family="sans-serif" x="304" y="260">E</text>
  <text text-anchor="middle" font-family="sans-serif" x="280" y="132">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="336" y="260">y</text>
  <text text-anchor="middle" font-family="sans-serif" x="328" y="276">K</text>
  <text text-anchor="middle" font-family="sans-serif" x="472" y="404">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="304" y="420">)</text>
  <text text-anchor="middle" font-family="sans-serif" x="224" y="132">D</text>
  <text text-anchor="middle" font-family="sans-serif" x="288" y="148">o</text>
  <text text-anchor="middle" font-family="sans-serif" x="176" y="260">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="312" y="260">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="288" y="420">i</text>
  <text text-anchor="middle" font-family="sans-serif" x="264" y="116">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="272" y="116">y</text>
  <text text-anchor="middle" font-family="sans-serif" x="344" y="276">y</text>
  <text text-anchor="middle" font-family="sans-serif" x="256" y="116">K</text>
  <text text-anchor="middle" font-family="sans-serif" x="72" y="404">x</text>
  <text text-anchor="middle" font-family="sans-serif" x="248" y="148">u</text>
  <text text-anchor="middle" font-family="sans-serif" x="272" y="388">y</text>
  <text text-anchor="middle" font-family="sans-serif" x="488" y="404">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="264" y="20">s</text>
  <text text-anchor="middle" font-family="sans-serif" x="72" y="132">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="256" y="148">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="496" y="404">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="288" y="20">r</text>
  <text text-anchor="middle" font-family="sans-serif" x="56" y="404">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="480" y="404">r</text>
  <text text-anchor="middle" font-family="sans-serif" x="256" y="388">c</text>
  <text text-anchor="middle" font-family="sans-serif" x="240" y="420">y</text>
  <text text-anchor="middle" font-family="sans-serif" x="456" y="404">p</text>
  <text text-anchor="middle" font-family="sans-serif" x="504" y="404">x</text>
  <text text-anchor="middle" font-family="sans-serif" x="280" y="20">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="296" y="132">o</text>
  <text text-anchor="middle" font-family="sans-serif" x="248" y="260">n</text>
  <text text-anchor="middle" font-family="sans-serif" x="264" y="36">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="64" y="404">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="448" y="404">i</text>
</g></svg>
</artwork>
</figure>
<t>This approach to encryption offers considerably greater flexibility allowing the same format for data item encryption to be applied at the transport, message or field level.</t>
</section>
<section title="Data Erasure" anchor="n-data-erasure"><t>Each encrypted DARE Envelope specifies a unique Master Salt value of at least 128 bits which is used to derive the salt values used to derive cryptographic keys for the envelope payload and annotations.</t>
<t>Erasure of the Master Salt value <bcp14>MAY</bcp14> be used to effectively render the envelope payload and annotations undecipherable without altering the envelope payload data. The work factor for decryption will be O(2^128) even if the decryption key is compromised.</t>
</section>
</section>
<section title="Signature" anchor="n-signature"><t>As with encryption, DARE Envelope signatures <bcp14>MAY</bcp14> be applied to an individual envelope or a sequence of envelope. </t>
<section title="Signing Individual Plaintext Envelopes" anchor="n-signing-individual-plaintext-envelopes"><t>When an individual plaintext envelope is signed, the digest value used to create the signature is calculated over the binary value of the payload data. That is, the value of the payload before the encoding (Base-64, JSON-B) is applied. </t>
</section>
<section title="Signing Individual Encrypted Envelopes" anchor="n-signing-individual-encrypted-envelopes"><t>When an individual plaintext envelope is signed, the digest value used to create the signature is calculated over the binary value of the payload data. That is, the value of the payload after encryption but before the encoding (Base-64, JSON-B) is applied. </t>
<t>Use of signing and encryption in combination presents the risk of subtle attacks depending on the order in which signing and encryption take place <xref target="Davis2001"></xref>.</t>
<t>Na?ve approaches in which an envelope is encrypted and then signed present the possibility of a surreptitious forwarding attack. For example, Alice signs an envelope and sends it to Mallet who then strips off Alice's signature and sends the envelope to Bob.  </t>
<t>Na?ve approaches in which an envelope is signed and then encrypted present the possibility of an attacker claiming authorship of a ciphertext. For example, Alice encrypts a ciphertext for Bob and then signs it. Mallet then intercepts the envelope and sends it to Bob.</t>
<t>While neither attack is a concern in all applications, both attacks pose potential hazards for the unwary and require close inspection of application protocol design to avoid exploitation.</t>
<t>To prevent these attacks, each signature on an envelope that is signed and encrypted <bcp14>MUST</bcp14> include a witness value that is calculated by applying a MAC function to the signature value as described in section XXX.</t>
</section>
<section title="Signing sequences of envelopes" anchor="n-signing-sequences-of-envelopes"><t>To sign multiple envelopes with a single signature, we first construct a Merkle tree of the envelope payload digest values and then sign the root of the Merkle tree.</t>
<t>[This is not yet implemented but will be soon.]</t>
</section>
</section>
<section title="Sequence" anchor="n-sequence"><t>DARE Sequence is a message and file syntax that allows a sequence of data frames to be represented with cryptographic integrity, signature, and encryption enhancements to be constructed in an append only format.</t>
<t>The format is designed to meet the requirements of a wide range of use cases including:</t>
<ul>
<li>Recording transactions in persistent storage.</li>
<li>Synchronizing transaction logs between hosts.</li>
<li>File archive.</li>
<li>Message spool.</li>
<li>Signing and encrypting single data items.</li>
<li>Incremental encryption and authentication of server logs.</li>
</ul>
<section title="Sequence Format" anchor="n-sequence-format"><t>A Sequence consists of a sequence of variable length Frames. Each frame consists of a forward length indicator, the framed data and a reverse length indicator. The reverse length indicator is written out backwards allowing the length and thus the frame to be read in the reverse direction: </t>
<figure>
<name>
JBCD Bidirectional Frame</name>
<!-- Include SVG File ../Images/DAREjbcdContainer.svg --><artwork type="svg">
<svg width="400" height="57" xmlns="http://www.w3.org/2000/svg" >
<g transform="translate(8,16)">
  <path d="M 0,0 L 40,0" fill="none" stroke="black" />
  <path d="M 40,0 L 80,0" fill="none" stroke="black" />
  <path d="M 80,0 L 120,0" fill="none" stroke="black" />
  <path d="M 120,0 L 264,0" fill="none" stroke="black" />
  <path d="M 264,0 L 304,0" fill="none" stroke="black" />
  <path d="M 304,0 L 344,0" fill="none" stroke="black" />
  <path d="M 344,0 L 384,0" fill="none" stroke="black" />
  <path d="M 0,32 L 40,32" fill="none" stroke="black" />
  <path d="M 40,32 L 80,32" fill="none" stroke="black" />
  <path d="M 80,32 L 120,32" fill="none" stroke="black" />
  <path d="M 120,32 L 264,32" fill="none" stroke="black" />
  <path d="M 264,32 L 304,32" fill="none" stroke="black" />
  <path d="M 304,32 L 344,32" fill="none" stroke="black" />
  <path d="M 344,32 L 384,32" fill="none" stroke="black" />
  <path d="M 0,0 L 0,32" fill="none" stroke="black" />
  <path d="M 40,0 L 40,32" fill="none" stroke="black" />
  <path d="M 80,0 L 80,32" fill="none" stroke="black" />
  <path d="M 120,0 L 120,32" fill="none" stroke="black" />
  <path d="M 264,0 L 264,32" fill="none" stroke="black" />
  <path d="M 304,0 L 304,32" fill="none" stroke="black" />
  <path d="M 344,0 L 344,32" fill="none" stroke="black" />
  <path d="M 384,0 L 384,32" fill="none" stroke="black" />
  <text text-anchor="middle" font-family="sans-serif" x="320" y="20">0</text>
  <text text-anchor="middle" font-family="sans-serif" x="24" y="20">5</text>
  <text text-anchor="middle" font-family="sans-serif" x="192" y="20">b</text>
  <text text-anchor="middle" font-family="sans-serif" x="200" y="20">y</text>
  <text text-anchor="middle" font-family="sans-serif" x="216" y="20">e</text>
  <text text-anchor="middle" font-family="sans-serif" x="232" y="20">&gt;</text>
  <text text-anchor="middle" font-family="sans-serif" x="280" y="20">2</text>
  <text text-anchor="middle" font-family="sans-serif" x="96" y="20">2</text>
  <text text-anchor="middle" font-family="sans-serif" x="104" y="20">C</text>
  <text text-anchor="middle" font-family="sans-serif" x="160" y="20">3</text>
  <text text-anchor="middle" font-family="sans-serif" x="176" y="20">0</text>
  <text text-anchor="middle" font-family="sans-serif" x="368" y="20">5</text>
  <text text-anchor="middle" font-family="sans-serif" x="56" y="20">0</text>
  <text text-anchor="middle" font-family="sans-serif" x="152" y="20">&lt;</text>
  <text text-anchor="middle" font-family="sans-serif" x="208" y="20">t</text>
  <text text-anchor="middle" font-family="sans-serif" x="224" y="20">s</text>
  <text text-anchor="middle" font-family="sans-serif" x="288" y="20">C</text>
  <text text-anchor="middle" font-family="sans-serif" x="328" y="20">1</text>
  <text text-anchor="middle" font-family="sans-serif" x="16" y="20">F</text>
  <text text-anchor="middle" font-family="sans-serif" x="64" y="20">1</text>
  <text text-anchor="middle" font-family="sans-serif" x="168" y="20">0</text>
  <text text-anchor="middle" font-family="sans-serif" x="360" y="20">F</text>
</g></svg>
</artwork>
</figure>
<t>Each frame contains a single DARE Envelope consisting of a Header, Payload and Trailer (if required). The first frame in a container describes the container format options and defaults. These include the range of encoding options for frame metadata supported and the container profiles to which the container conforms. </t>
<t>All internal data formats support use of pointers of up to 64 bits allowing containers of up to 18 exabytes to be written. </t>
<t>Five container types are currently specified:</t>
<dl>
<dt>Simple</dt>
<dd>
<t>The container does not provide any index or content integrity checks.</t>
</dd>
<dt>Tree</dt>
<dd>
<t>Frame headers contain entries that specify the start position of previous frames at the apex of the immediately enclosing binary tree. This enables efficient random access to any frame in the file.</t>
</dd>
<dt>Digest</dt>
<dd>
<t>Each frame trailer contains a <tt>PayloadDigest</tt> field. Modification of the payload will cause verification of the <tt>PayloadDigest</tt> value to fail on that frame.</t>
</dd>
<dt>Chain</dt>
<dd>
<t>Each frame trailer contains <tt>PayloadDigest</tt> and <tt>ChainDigest</tt> fields allowing modifications to the payload data to be detected. Modification of the payload will cause verification of the <tt>PayloadDigest</tt> value to fail on that frame and verification of the <tt>ChainDigest</tt> value to fail on all subsequent frames.</t>
</dd>
<dt>Merkle Tree</dt>
<dd>
<t>Frame headers contain entries that specify the start position of previous frames at the apex of the immediately enclosing binary tree. Frame Trailers contain TreeDigestPartial and TreeDigestFinal entries forming a Merkle digest tree.</t>
</dd>
</dl>
<t>Currently, the Mesh only makes use of the Merkle Tree sequence type.</t>
</section>
<section title="Write" anchor="n-write"><t>In normal circumstances, Sequences are written as an append only log. As with Envelopes, integrity information (payload digest, signatures) is written to the entry trailer. Thus, large payloads may be written without the need to buffer the payload data <em>provided that</em> the content length is known in advance.</t>
<t>Should exceptional circumstances require, Sequence entries <bcp14>MAY</bcp14> be erased by overwriting the Payload and/or parts of the Header content without compromising the ability to verify other entries in the container. If the entry Payload is encrypted, it is sufficient to erase the container salt value to render the container entry effectively inaccessible (though recovery might still be possible if the original salt value can be recovered from the storage media.</t>
</section>
<section title="Encryption and Authentication" anchor="n-encryption-and-authentication"><t>Frame payloads and associated attributes <bcp14>MAY</bcp14> be encrypted and/or authenticated in the same manner as Envelopes. </t>
<t><em>Incremental encryption</em> is supported allowing encryption parameters from a single public key exchange operation to be applied to encrypt multiple frames. The public key exchange information is specified in the first encrypted frame and subsequent frames encrypted under those parameters specify the location at which the key exchange information is to be found by means of the ExchangePosition field which <bcp14>MUST</bcp14> specify a location that is earlier in the file.</t>
<t>To avoid cryptographic vulnerabilities resulting from key re-use, the DARE key exchange requires that each encrypted sequence use an encryption key and initialization vector derived from the master key established in the public key exchange by means of a unique salt specified in each envelope.</t>
<t>Each Envelope and by extension, each Sequence frame <bcp14>MUST</bcp14> specify a unique salt value of at least 128 bits. Since the encryption key is derived from the salt value by means of a Key Derivation Function, erasure of the salt <bcp14>MAY</bcp14> be used as a means of rendering the payload plaintext value inaccessible without changing the payload value. </t>
</section>
<section title="Integrity and Signature" anchor="n-integrity-and-signature"><t>Signatures <bcp14>MAY</bcp14> be applied to a payload digest, the final digest in a chain or tree. The chain and tree digest modes allow a single signature to be used to authenticate all frame payloads in a container.</t>
<t>The tree signature mode is particularly suited to applications such as file archives as it allows files to be verified individually without requiring the signer to sign each individually. Furthermore, in applications such as code signing, it allows a single signature to be used to verify both the integrity of the code and its membership of the distribution.</t>
<t>As with DARE Envelope, the signature mechanism does not specify the interpretation of the signature semantics. The presence of a signature demonstrates that the holder of the private key applied it to the specified digest value but not their motive for doing so. Describing such semantics is beyond the scope of this document and is deferred to future work.</t>
</section>
<section title="Redaction" anchor="n-redaction"><t>The chief disadvantage of using an append-only format is that containers only increase in size. In many applications, much of the data in the container becomes redundant or obsolete and a process analogous to garbage collection is required. This process is called <em>redaction</em>.</t>
<t>The simplest method of redaction is to create a new container and sequentially copy each entry from the old container to the new, discarding redundant frames and obsolete header information. </t>
<t>For example, partial index records may be consolidated into a single index record placed in the last frame of the container. Unnecessary signature and integrity data may be discarded and so on.</t>
<t>While redaction could in principle be effected by moving data in-place in the existing container, supporting this approach in a robust fashion is considerably more complex as it requires backward references in subsequent frames to be overridden as each frame is moved. </t>
</section>
<section title="Alternative approaches" anchor="n-alternative-approaches"><t>Many file proprietary formats are in use that support some or all of these capabilities but only a handful have public, let alone open, standards. DARE Sequence is designed to provide a superset of the capabilities of existing message and file syntaxes, including:</t>
<ul>
<li>Cryptographic Message Syntax <xref target="RFC5652"></xref> defines a syntax used to digitally sign, digest, authenticate, or encrypt arbitrary message content.</li>
<li>The.ZIP File Format specification <xref target="ZIPFILE"></xref> developed by Phil Katz. </li>
<li>The BitCoin Block chain <xref target="BLOCKCHAIN"></xref>.</li>
<li>JSON Web Encryption and JSON Web Signature</li>
</ul>
<t>Attempting to make use of these specifications in a layered fashion would require at least three separate encoders and introduce unnecessary complexity. Furthermore, there is considerable overlap between the specifications providing multiple means of achieving the same ends, all of which must be supported if decoders are to work reliably.</t>
</section>
<section title="Efficiency" anchor="n-efficiency"><t>Every data format represents a compromise between different concerns, in particular:</t>
<dl>
<dt>Compactness</dt>
<dd>
<t>The space required to record data in the encoding.</t>
</dd>
<dt>Memory Overhead</dt>
<dd>
<t>The additional volatile storage (RAM) required to maintain indexes etc. to support efficient retrieval operations.</t>
</dd>
<dt>Number of Operations</dt>
<dd>
<t>The number of operations required to retrieve data from or append data to an existing encoded sequence.</t>
</dd>
<dt>Number of Disk Seek Operations</dt>
<dd>
<t>Optimizing the response time of magnetic storage media to random access read requests has traditionally been one of the central concerns of database design. The DARE Sequence format is designed to the assumption that this will cease to be a concern as solid state media replaces magnetic.</t>
</dd>
</dl>
<t>While the cost of storage of all types has declined rapidly over the past decades, so has the amount of data to be stored. DARE Sequence represents a pragmatic balance of these considerations for current technology. In particular, since payload volumes are likely to be very large, memory and operational efficiency are considered higher priorities than compactness.</t>
</section>
</section>
</section>
<section title="Definitions" anchor="n-definitions"><section title="Related Specifications" anchor="n-related-specifications"><t>The DARE Envelope and Sequence formats are based on the following existing standards and specifications.</t>
<dl>
<dt>Object serialization</dt>
<dd>
<t>The JSON-B <xref target="draft-hallambaker-jsonbcd"></xref> encoding is used for object serialization. This encoding is an extension of the JavaScript Object Notation (JSON) <xref target="RFC7159"></xref>.</t>
</dd>
<dt>Message syntax</dt>
<dd>
<t>The cryptographic processing model is based on JSON Web Signature (JWS) <xref target="RFC7515"></xref>, JSON Web Encryption (JWE) <xref target="RFC7516"></xref> and JSON Web Key (JWK) <xref target="RFC7517"></xref>.</t>
</dd>
<dt>Cryptographic primitives.</dt>
<dd>
<t>The HMAC-based Extract-and-Expand Key Derivation Function <xref target="RFC5869"></xref> and Advanced Encryption Standard (AES) Key Wrap with Padding Algorithm <xref target="RFC3394"></xref> are used.</t>
<t>The Uniform Data Fingerprint method of presenting data digests is used for key identifiers and other purposes <xref target="draft-hallambaker-mesh-udf"></xref>.</t>
</dd>
<dt>Cryptographic algorithms</dt>
<dd>
<t>The cryptographic algorithms and identifiers described in JSON Web Algorithms (JWA) <xref target="RFC7518"></xref> are used together with additional algorithms as defined in the JSON Object Signing and Encryption IANA registry <xref target="IANAJOSE"></xref>.</t>
</dd>
</dl>
</section>
<section title="Requirements Language" anchor="n-requirements-language"><t>The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as described in <xref target="RFC2119"></xref>.</t>
</section>
<section title="Defined terms" anchor="n-defined-terms"><t>The terms "Authentication Tag", "Content Encryption Key", "Key Management Mode", "Key Encryption", "Direct Key Agreement", "Key Agreement with Key Wrapping" and "Direct Encryption" are defined in the JWE specification <xref target="RFC7516"></xref>.</t>
<t>The terms "Authentication", "Ciphertext", "Digital Signature", "Encryption", "Initialization Vector (IV)", "Message Authentication Code (MAC)", "Plaintext" and "Salt" are defined by the Internet Security Glossary, Version 2 <xref target="RFC4949"></xref>. </t>
<dl>
<dt>Annotated Envelope</dt>
<dd>
<t>A DARE Envelope that contains an <tt>Annotations</tt> field with at least one entry.</t>
</dd>
<dt>Authentication Data</dt>
<dd>
<t>A Message Authentication Code or authentication tag.</t>
</dd>
<dt>Complete Envelope</dt>
<dd>
<t>A DARE envelope that contains the key exchange information necessary for the intended recipient(s) to decrypt it.</t>
</dd>
<dt>Detached Envelope</dt>
<dd>
<t>A DARE envelope that does not contain the key exchange information necessary for the intended recipient(s) to decrypt it.</t>
</dd>
<dt>Encryption Context</dt>
<dd>
<t>The master key, encryption algorithms and associated parameters used to generate a set of one or more enhanced data sequences.</t>
</dd>
<dt>Encoded data sequence (EDS)</dt>
<dd>
<t>A sequence consisting of a salt, content data and authentication data (if required by the encryption context).</t>
</dd>
<dt>Enhancement</dt>
<dd>
<t>Applying a cryptographic operation to a data sequence. This includes encryption, authentication and both at the same time.</t>
</dd>
<dt>Generator</dt>
<dd>
<t>The party that generates a DARE envelope.</t>
</dd>
<dt>Group Encryption Key</dt>
<dd>
<t>A key used to encrypt data to be read by a group of users. This is typically achieved by means of some form of proxy re-encryption or distributed key generation.</t>
</dd>
<dt>Group Encryption Key Identifier</dt>
<dd>
<t>A key identifier for a group encryption key.</t>
</dd>
<dt>Master Key (MK)</dt>
<dd>
<t>The master secret from which keys are derived for authenticating enhanced data sequences.</t>
</dd>
<dt>Recipient</dt>
<dd>
<t>Any party that receives and processes at least some part of a DARE envelope.</t>
</dd>
<dt>Related Envelope</dt>
<dd>
<t>A set of DARE envelopes that share the same key exchange information and hence the same Master Key.</t>
</dd>
<dt>Uniform Data Fingerprint (UDF)</dt>
<dd>
<t>The means of presenting the result of a cryptographic digest function over a data sequence and content type identifier specified in the Uniform Data Fingerprint specification <xref target="draft-hallambaker-mesh-udf"></xref></t>
</dd>
</dl>
</section>
</section>
<section title="DARE Envelope Architecture" anchor="n-dare-envelope-architecture"><t>A DARE Envelope is a sequence of three parts:</t>
<dl>
<dt>Header</dt>
<dd>
<t>A JSON object containing information a reader requires to begin processing the envelope.</t>
</dd>
<dt>Payload</dt>
<dd>
<t>An array of octets.</t>
</dd>
<dt>Trailer</dt>
<dd>
<t>A JSON object containing information calculated from the envelope payload.</t>
</dd>
</dl>
<t>For example, the following sequence is a JSON encoded Envelope with an empty header, a payload of zero length and an empty trailer:</t>
<sourcecode>[ {}, "", {} ]</sourcecode>
<t>DARE Envelopes <bcp14>MAY</bcp14> be encoded using JSON serialization or a binary serialization for greater efficiency.</t>
<dl>
<dt>JSON <xref target="RFC7159"></xref></dt>
<dd>
<t>Offers compatibility with applications and libraries that support JSON. Payload data is encoded using Base64 incurring a 33% overhead.</t>
</dd>
<dt>JSON-B <xref target="draft-hallambaker-jsonbcd"></xref></dt>
<dd>
<t>A superset of JSON encoding that permits binary data to be encoded as a sequence of length-data segments. This avoids the Base64 overhead incurred by JSON encoding. Since JSON-B is a superset of JSON encoding, an application can use a single decoder for either format.</t>
</dd>
<dt>JSON-C <xref target="draft-hallambaker-jsonbcd"></xref></dt>
<dd>
<t>A superset of JSON-C which provides additional efficiency by allowing field tags and other repeated string data to be encoded by reference to a dictionary. Since JSON-C is a superset of JSON and JSON-B encodings, an application can use a single decoder for all three formats.</t>
</dd>
</dl>
<t>DARE Envelope processors <bcp14>MUST</bcp14> support JSON serialization and <bcp14>SHOULD</bcp14> support JSON-B serialization. </t>
<section title="Processing Considerations" anchor="n-processing-considerations"><t>The DARE Envelope Syntax supports single pass encoding and decoding without buffering of data. All the information required to begin processing a DARE envelope (key agreement information, digest algorithms), is provided in the envelope header. All the information that is derived from envelope processing (authentication codes, digest values, signatures) is presented in the envelope trailer.</t>
<t>The choice of envelope encoding does not affect the semantics of envelope processing. A DARE Envelope <bcp14>MAY</bcp14> be reserialized under the same serialization or converted from any of the specified serialization to any other serialization without changing the semantics or integrity properties of the envelope.</t>
</section>
<section title="Encoded Data Sequence" anchor="n-encoded-data-sequence"><t>An encoded data sequence (EDS) is a sequence of octets that encodes a data sequence according to cryptographic enhancements specified in the context in which it is presented. An EDS <bcp14>MAY</bcp14> be encrypted and <bcp14>MAY</bcp14> be authenticated by means of a MAC. The keys and other cryptographic parameters used to apply these enhancements are derived from the cryptographic context and a Salt prefix specified in the EDS itself.</t>
<t>An EDS sequence contains exactly three binary fields encoded in JSON-B serialization as follows:</t>
<dl>
<dt>Salt Prefix</dt>
<dd>
<t>A sequence of octets used to derive the encryption key, Initialization Vector and MAC key as required.</t>
</dd>
<dt>Body</dt>
<dd>
<t>The plaintext or encrypted content.</t>
</dd>
<dt>Authentication Tag</dt>
<dd>
<t>The authentication code value in the case that the cryptographic context specifies use of authenticated encryption or a MAC, otherwise is a zero-length field.</t>
</dd>
</dl>
<t>Requiring all three fields to be present, even in cases where they are unnecessary simplifies processing at the cost of up to six additional data bytes.</t>
<t>The encoding of the 'From' header of the previous example as a plaintext EDS is as follows: </t>
<sourcecode>88 01
  00
88 17
  46 72 6f 6d 3a 20 41 6c   69 63 65 40 65 78 61 6d
  70 6c 65 2e 63 6f 6d
[EOF]

</sourcecode>
</section>
<section title="Content Metadata and Annotations" anchor="n-content-metadata-and-annotations"><t>A header <bcp14>MAY</bcp14> contain header fields describing the payload content. These include:</t>
<dl>
<dt>ContentType</dt>
<dd>
<t>Specifies the IANA Media Type <xref target="RFC6838"></xref>.</t>
</dd>
<dt>Annotations</dt>
<dd>
<t>A list of Encoded Data Sequences that provide application specific annotations to the envelope.</t>
</dd>
</dl>
<t>For example, consider the following mail message: </t>
<sourcecode>From: Alice@example.com
To: bob@example.com
Subject: TOP-SECRET Product Launch Today!

The CEO told me the product launch is today. Tell no-one!</sourcecode>
<t>Existing encryption approaches require that header fields such as the subject line be encrypted  with the body of the message or not encrypted at all. Neither approach is satisfactory. In this example, the subject line gives away important information that the sender probably assumed would be encrypted. But if the subject line is encrypted together with the message body, a mail client must retrieve at least part of the message body to provide a  'folder' view. </t>
<t>The plaintext form of the equivalent DARE Message encoding is: </t>
<sourcecode>[{
    "annotations":["iAEAiBdGcm9tOiBBbGljZUBleGFtcGxlLmNvbQ",
      "iAEBiBNUbzogYm9iQGV4YW1wbGUuY29t",
      "iAECiClTdWJqZWN0OiBUT1AtU0VDUkVUIFByb2R1Y3QgTGF1bmNoIFRvZG
  F5IQ"
      ],
    "ContentMetaData":"ewogICJjdHkiOiAiYXBwbGljYXRpb24vZXhhbXBsZS
  1tYWlsIn0"},
  "VGhlIENFTyB0b2xkIG1lIHRoZSBwcm9kdWN0IGxhdW5jaCBpcyB0b2RheS4gVG
  VsbCBuby1vbmUh"
  ]</sourcecode>
<t>This contains the same information as before but the data we might wish to encrypt to protect the confidentiality of the payload is separated from data required for  processing. </t>
</section>
<section title="Encryption and Integrity" anchor="n-encryption-and-integrity-0"><t>Encryption and integrity protections <bcp14>MAY</bcp14> be applied to any DARE Envelope Payload and Annotations.</t>
<t>The following is an encrypted version of the message shown earlier.  The payload and annotations have both increased in size as a result of the block cipher padding. The header now includes Recipients and Salt fields to enable the content to be decoded. </t>
<sourcecode>[{
    "enc":"A256CBC",
    "kid":"EBQH-DZU4-OTBI-AU2S-GNV3-MCRC-ED4E",
    "Salt":"TbOCuU1R3DukFGiPHvUzGA",
    "annotations":["iAEAiCBETXQS-oRUR2pLCMmR-DSAK7dsgDT7cpx78tTp7p
  R_tw",
      "iAEBiCCaaV-biycHa_2d6OSN-hBFaZ9iZP02H0r9o31UYudmIg",
      "iAECiDDGlql_kF-lkY-hwda0BIUtb2R5cPxjhD1tJ3Z_riDgRawQ3fGQDG
  H5mXH8trm1tNM"
      ],
    "recipients":[{
        "kid":"MC3P-SEXC-G5NY-LUUQ-CDZU-JZTN-HMPX",
        "epk":{
          "PublicKeyECDH":{
            "crv":"Ed25519",
            "Public":"MweSwFKcWc118xw_-6BPcFdOxBjNghuRJfFiSZvjT8A"}},
        "wmk":"Qjku5l0gilHFtU4dbmL1uq3BACYz5ktkK-Oa9EZdL0Bw4Kr14T
  -TFg"}
      ],
    "ContentMetaData":"ewogICJjdHkiOiAiYXBwbGljYXRpb24vZXhhbXBsZS
  1tYWlsIn0"},
  "bnhfGQJMHXrSP1Ho1iVfFswSj4eEzc9BNv_kPeQB9FABVMRDveiiLIDgBeMLt2
  WZCmh5lWYH1i37rJm19BdOHw"
  ]</sourcecode>
<t>For efficiency of processing, the ContentMetaData is presented in plaintext. This header could be encrypted as an EDS sequence and presented as a  cloaked header. </t>
<section title="Key Exchange" anchor="n-key-exchange-0"><t>The DARE key exchange is based on the JWE key exchange except that encryption modes are intentionally limited and the output of the key exchange is the DARE Master Key rather than the Content Encryption Key.</t>
<t>A DARE Key Exchange <bcp14>MAY</bcp14> contain any number of Recipient entries, each providing a means of decrypting the Master Key using a different private key.</t>
<t>If the Key Exchange mechanism supports message recovery, Direct Key Agreement is used, in all other cases, Key Wrapping is used.</t>
<t>This approach allows envelopes with one intended recipient to be handled in the exact same fashion as envelopes with multiple recipients. While this does require an additional key wrapping operation, that could be avoided if an envelope has exactly one intended recipient, this is offset by the reduction in code complexity.</t>
<t>If the key exchange algorithm does not support message recovery (e.g. Diffie Hellman and Elliptic Curve Diffie-Hellman), the HKDF Extract-and-Expand Key Derivation Function is used to derive a master key using the following info tag:</t>
<dl>
<dt>"dare-master" [64 61 72 65 2d 6d 61 73 74 65 72]</dt>
<dd>
<t>Key derivation info field used when deriving a master key from the output of a key exchange.</t>
</dd>
</dl>
<t>The master key length is the maximum of the key size of the encryption algorithm specified by the key exchange header, the key size of the MAC algorithm specified by the key exchange header (if used) and 256.</t>
</section>
<section title="Key Identifiers" anchor="n-key-identifiers"><t>The JWE/JWS specifications define a kid field for use as a key identifier but not how the identifier itself is constructed. All DARE key identifiers are either UDF key fingerprints <xref target="draft-hallambaker-mesh-udf"></xref> or Mesh/Recrypt Group Key Identifiers.</t>
<t>A UDF fingerprint is formed as the digest of an IANA content type and the digested data. A UDF key fingerprint is formed with the content type <tt>application/pkix-keyinfo</tt> and the digested data is the ASN.1 DER encoded PKIX certificate <tt>keyInfo</tt> sequence for the corresponding public key.</t>
<t>A Group Key Identifier has the form &lt;fingerprint&gt;@&lt;domain&gt;. Where &lt;fingerprint&gt; is a UDF key fingerprint and &lt;domain&gt; is the DNS address of a service that provides the encryption service to support decryption by group members.</t>
</section>
<section title="Salt Derivation" anchor="n-salt-derivation"><t>A Master Salt is a sequence of 16 or more octets that is specified in the Salt field of the header.</t>
<t>The Master Salt is used to derive salt values for the envelope payload and associated encoded data sequences as follows.</t>
<dl>
<dt>Payload</dt>
<dd>
<t>Salt = Master Salt</t>
</dd>
<dt>EDS</dt>
<dd>
<t>Salt = Concatenate (Payload Salt Prefix,  Master Salt)</t>
</dd>
</dl>
<t>Encoders <bcp14>SHOULD NOT</bcp14> generate salt values that exceed 1024 octets.</t>
<t>The salt value is opaque to the DARE encoding but <bcp14>MAY</bcp14> be used to encode application specific semantics including:</t>
<ul>
<li>Frame number to allow reassembly of a data sequence split over a sequence of envelopes which may be delivered out of order.</li>
<li>Transmit the Master Key in the manner of a Kerberos ticket.</li>
<li>Identify the Master Key under which the Enhanced Data Sequence was generated.</li>
<li>Enable access to the plaintext to be eliminated by erasure of the encryption key.</li>
</ul>
<t>For data erasure to be effective, the salt <bcp14>MUST</bcp14> be constructed so that the difficulty of recovering the key is sufficiently high that it is infeasible. For most purposes, a salt with 128 bits of appropriately random data is sufficient.</t>
</section>
<section title="Key Derivation" anchor="n-key-derivation"><t>Encryption and/or authentication keys are derived from the Master Key using a Extract-and-Expand Key Derivation Function as follows:</t>
<ol start="0">
<li>The Master Key and salt value are used to extract the PRK (pseudorandom key)</li>
<li>The PRK is used to derive the algorithm keys using the application specific information input for that key type.</li>
</ol>
<t>The application specific information inputs are:</t>
<dl>
<dt>"dare-encrypt" [64 61 72 65 2d 65 6e 63 72 79 70 74]</dt>
<dd>
<t>To generate an encryption or encryption with authentication key.</t>
</dd>
<dt>"dare-iv" [64 61 72 65 2d 65 6e 63 72 79 70 74]</dt>
<dd>
<t>To generate an initialization vector.</t>
</dd>
<dt>"dare-mac" [dare-mac]</dt>
<dd>
<t>To generate a Message Authentication Code key.</t>
</dd>
</dl>
</section>
</section>
<section title="Signature" anchor="n-signature-0"><t>While encryption and integrity enhancements can be applied to any part of a DARE Envelope, signatures are only applied to payload digest values calculated over one or more envelope payloads. </t>
<t>The payload digest value for an envelope is calculated over the binary payload data. That is, after any encryption enhancement has been applied but before the envelope encoding is applied. This allows envelopes to be converted from one encoding to another without affecting signature verification. </t>
<dl>
<dt>Single Payload</dt>
<dd>
<t>The signed value is the payload digest of the envelope payload.</t>
</dd>
<dt>Multiple Payload.</dt>
<dd>
<t>The signed value is the root of a Merkle Tree in which the payload digest of the envelope is one of the leaves.</t>
</dd>
</dl>
<t>Verification of a multiple payload signature naturally requires the additional digest values required to construct the Merkle Tree. These are provided in the Trailer in a format that permits multiple signers to reference the same tree data.</t>
</section>
<section title="Algorithms" anchor="n-algorithms"><section title="Field: kwd" anchor="n-field-kwd"><t>The key wrapping and derivation algorithms.</t>
<t>Since the means of public key exchange is determined by the key identifier of the recipient key, it is only necessary to specify the algorithms used for key wrapping and derivation.</t>
<t>The default (and so far only) algorithm is kwd-aes-sha2-256-256.</t>
<t>Advanced Encryption Standard (AES) Key Wrap with Padding Algorithm <xref target="RFC3394"></xref> is used to wrap the Master Exchange Key. AES 256 is used.</t>
<t>HMAC-based Extract-and-Expand Key Derivation Function <xref target="RFC5869"></xref> is used for key derivation. SHA-2-256 is used for the hash function.</t>
</section>
</section>
</section>
<section title="DARE Sequence Architecture" anchor="n-dare-sequence-architecture"><section title="Sequence Navigation" anchor="n-sequence-navigation"><t>Three means of locating frames in a container are supported:</t>
<dl>
<dt>Sequential</dt>
<dd>
<t>Access frames sequentially starting from the start or the end of the container.</t>
</dd>
<dt>Binary search</dt>
<dd>
<t>Access any container frame by frame number in <em>O(log<sub>2</sub>(n)) time by means of a binary tree constructed while the container is written.</em></t>
</dd>
<dt>Index</dt>
<dd>
<t>Access and container frame by frame number or by key by means of an index record.</t>
</dd>
</dl>
<t>All DARE Sequences support sequential access. Only tree and Merkle tree containers support binary search access. An index frame <bcp14>MAY</bcp14> be written appended to any container and provides <em>O(1)</em> access to any frame listed in the index.</t>
<t>Two modes of compilation are considered:</t>
<dl>
<dt>Monolithic</dt>
<dd>
<t>Frames are added to the container in a single operation, e.g. file archives, </t>
</dd>
<dt>Incremental</dt>
<dd>
<t>Additional frames are written to the container at various intervals after it was originally created, e.g. server logs, message spools.</t>
</dd>
</dl>
<t>In the monolithic mode, navigation requirements are best met by writing an index frame to the end of the container when it is complete. It is not necessary to construct a binary search tree unless a Merkle tree integrity check is required.</t>
<t>In the incremental mode, Binary search provides an efficient means of locating frames by frame number but not by key. Writing a complete index to the container every <em>m</em> write operations provides <em>O(m)</em> search access but requires <em>O(n<sup>2</sup>) storage.</em></t>
<t>Use of partial indexes provides a better compromise between speed and efficiency. A partial index is written out every <em>m</em> frames where <em>m</em> is a power of two. A complete index is written every time a binary tree apex record is written. This approach provides for <em>O(log<sub>2</sub>(n)) search with incremental compilation with approximately double the overhead of the monolithic case.</em></t>
<section title="Tree" anchor="n-tree"><t>As previously described, the JBCD frame structure allows incremental navigation to the immediately preceding frame. The <tt>TreePosition</tt> parameter specifies the start position of <em>any</em> previous frame in the container, thus allowing rapid navigation to that point.</t>
<t>The TreePosition parameter <bcp14>MAY</bcp14> be used to enable any frame in the container to be retrieved in log<sub>2</sub>(n) time by means of a binary search. The TreePosition parameter specifies the immediately preceding apex of a binary tree formed from the container entries.</t>
<t>For example, the TreePosition of frame 6 in a container gives the location of frame 5, the TreePosition of frame 5 gives the location of frame 3, the TreePosition of frame 3 gives the location of frame 1, and the TreePosition of frame 1 gives the location of frame 0:</t>
<figure>
<name>
Binary search tree.</name>
<!-- Include SVG File ../Images/DAREMerkleTree1.svg --><artwork type="svg">
<svg width="512" height="281" xmlns="http://www.w3.org/2000/svg" >
<g transform="translate(8,16)">
  <path d="M 224,16 L 448,16" fill="none" stroke="black" />
  <path d="M 96,80 L 192,80" fill="none" stroke="black" />
  <path d="M 232,80 L 320,80" fill="none" stroke="black" />
  <path d="M 32,144 L 64,144" fill="none" stroke="black" />
  <path d="M 104,144 L 128,144" fill="none" stroke="black" />
  <path d="M 232,144 L 256,144" fill="none" stroke="black" />
  <path d="M 360,144 L 384,144" fill="none" stroke="black" />
  <path d="M 40,224 L 64,224" fill="none" stroke="black" />
  <path d="M 104,224 L 128,224" fill="none" stroke="black" />
  <path d="M 168,224 L 192,224" fill="none" stroke="black" />
  <path d="M 232,224 L 256,224" fill="none" stroke="black" />
  <path d="M 296,224 L 320,224" fill="none" stroke="black" />
  <path d="M 360,224 L 384,224" fill="none" stroke="black" />
  <path d="M 424,224 L 448,224" fill="none" stroke="black" />
  <path d="M 16,160 L 16,192" fill="none" stroke="black" />
  <path d="M 16,192 L 16,208" fill="none" stroke="black" />
  <path d="M 80,96 L 80,112" fill="none" stroke="black" />
  <path d="M 80,112 L 80,128" fill="none" stroke="black" />
  <path d="M 80,160 L 80,208" fill="none" stroke="black" />
  <path d="M 144,160 L 144,208" fill="none" stroke="black" />
  <path d="M 208,32 L 208,48" fill="none" stroke="black" />
  <path d="M 208,48 L 208,64" fill="none" stroke="black" />
  <path d="M 208,96 L 208,128" fill="none" stroke="black" />
  <path d="M 208,160 L 208,208" fill="none" stroke="black" />
  <path d="M 272,160 L 272,208" fill="none" stroke="black" />
  <path d="M 336,96 L 336,128" fill="none" stroke="black" />
  <path d="M 336,160 L 336,208" fill="none" stroke="black" />
  <path d="M 400,160 L 400,208" fill="none" stroke="black" />
  <path d="M 464,32 L 464,64" fill="none" stroke="black" />
  <path d="M 464,96 L 464,128" fill="none" stroke="black" />
  <path d="M 464,160 L 464,208" fill="none" stroke="black" />
  <path d="M 16,192 L 16,200" fill="none" stroke="black" />
  <polygon points="32.000000,192.000000 20.000000,186.399994 20.000000,197.600006" fill="black" transform="rotate(90.000000, 16.000000, 192.000000)" />
  <polygon points="48.000000,224.000000 36.000000,218.399994 36.000000,229.600006" fill="black" transform="rotate(180.000000, 40.000000, 224.000000)" />
  <path d="M 80,112 L 80,120" fill="none" stroke="black" />
  <polygon points="96.000000,112.000000 84.000000,106.400002 84.000000,117.599998" fill="black" transform="rotate(90.000000, 80.000000, 112.000000)" />
  <polygon points="112.000000,144.000000 100.000000,138.399994 100.000000,149.600006" fill="black" transform="rotate(180.000000, 104.000000, 144.000000)" />
  <polygon points="112.000000,224.000000 100.000000,218.399994 100.000000,229.600006" fill="black" transform="rotate(180.000000, 104.000000, 224.000000)" />
  <polygon points="176.000000,224.000000 164.000000,218.399994 164.000000,229.600006" fill="black" transform="rotate(180.000000, 168.000000, 224.000000)" />
  <path d="M 208,48 L 208,56" fill="none" stroke="black" />
  <polygon points="224.000000,48.000000 212.000000,42.400002 212.000000,53.599998" fill="black" transform="rotate(90.000000, 208.000000, 48.000000)" />
  <polygon points="240.000000,80.000000 228.000000,74.400002 228.000000,85.599998" fill="black" transform="rotate(180.000000, 232.000000, 80.000000)" />
  <polygon points="240.000000,144.000000 228.000000,138.399994 228.000000,149.600006" fill="black" transform="rotate(180.000000, 232.000000, 144.000000)" />
  <polygon points="240.000000,224.000000 228.000000,218.399994 228.000000,229.600006" fill="black" transform="rotate(180.000000, 232.000000, 224.000000)" />
  <polygon points="304.000000,224.000000 292.000000,218.399994 292.000000,229.600006" fill="black" transform="rotate(180.000000, 296.000000, 224.000000)" />
  <polygon points="368.000000,144.000000 356.000000,138.399994 356.000000,149.600006" fill="black" transform="rotate(180.000000, 360.000000, 144.000000)" />
  <polygon points="368.000000,224.000000 356.000000,218.399994 356.000000,229.600006" fill="black" transform="rotate(180.000000, 360.000000, 224.000000)" />
  <polygon points="432.000000,224.000000 420.000000,218.399994 420.000000,229.600006" fill="black" transform="rotate(180.000000, 424.000000, 224.000000)" />
  <path d="M 464,0 A 16,16 0 0,0 448,16" fill="none" stroke="black" />
  <path d="M 464,0 A 16,16 0 0,1 480,16" fill="none" stroke="black" />
  <path d="M 224,16 A 16,16 0 0,0 208,32" fill="none" stroke="black" />
  <path d="M 448,16 A 16,16 0 0,0 464,32" fill="none" stroke="black" />
  <path d="M 480,16 A 16,16 0 0,1 464,32" fill="none" stroke="black" />
  <path d="M 208,64 A 16,16 0 0,0 192,80" fill="none" stroke="black" />
  <path d="M 208,64 A 16,16 0 0,1 224,80" fill="none" stroke="black" />
  <path d="M 464,64 A 16,16 0 0,0 448,80" fill="none" stroke="black" />
  <path d="M 464,64 A 16,16 0 0,1 480,80" fill="none" stroke="black" />
  <path d="M 96,80 A 16,16 0 0,0 80,96" fill="none" stroke="black" />
  <path d="M 320,80 A 16,16 0 0,1 336,96" fill="none" stroke="black" />
  <path d="M 192,80 A 16,16 0 0,0 208,96" fill="none" stroke="black" />
  <path d="M 224,80 A 16,16 0 0,1 208,96" fill="none" stroke="black" />
  <path d="M 448,80 A 16,16 0 0,0 464,96" fill="none" stroke="black" />
  <path d="M 480,80 A 16,16 0 0,1 464,96" fill="none" stroke="black" />
  <path d="M 80,128 A 16,16 0 0,0 64,144" fill="none" stroke="black" />
  <path d="M 80,128 A 16,16 0 0,1 96,144" fill="none" stroke="black" />
  <path d="M 208,128 A 16,16 0 0,0 192,144" fill="none" stroke="black" />
  <path d="M 208,128 A 16,16 0 0,1 224,144" fill="none" stroke="black" />
  <path d="M 336,128 A 16,16 0 0,0 320,144" fill="none" stroke="black" />
  <path d="M 336,128 A 16,16 0 0,1 352,144" fill="none" stroke="black" />
  <path d="M 464,128 A 16,16 0 0,0 448,144" fill="none" stroke="black" />
  <path d="M 464,128 A 16,16 0 0,1 480,144" fill="none" stroke="black" />
  <path d="M 32,144 A 16,16 0 0,0 16,160" fill="none" stroke="black" />
  <path d="M 128,144 A 16,16 0 0,1 144,160" fill="none" stroke="black" />
  <path d="M 256,144 A 16,16 0 0,1 272,160" fill="none" stroke="black" />
  <path d="M 384,144 A 16,16 0 0,1 400,160" fill="none" stroke="black" />
  <path d="M 64,144 A 16,16 0 0,0 80,160" fill="none" stroke="black" />
  <path d="M 96,144 A 16,16 0 0,1 80,160" fill="none" stroke="black" />
  <path d="M 192,144 A 16,16 0 0,0 208,160" fill="none" stroke="black" />
  <path d="M 224,144 A 16,16 0 0,1 208,160" fill="none" stroke="black" />
  <path d="M 320,144 A 16,16 0 0,0 336,160" fill="none" stroke="black" />
  <path d="M 352,144 A 16,16 0 0,1 336,160" fill="none" stroke="black" />
  <path d="M 448,144 A 16,16 0 0,0 464,160" fill="none" stroke="black" />
  <path d="M 480,144 A 16,16 0 0,1 464,160" fill="none" stroke="black" />
  <path d="M 16,208 A 16,16 0 0,0 0,224" fill="none" stroke="black" />
  <path d="M 16,208 A 16,16 0 0,1 32,224" fill="none" stroke="black" />
  <path d="M 80,208 A 16,16 0 0,0 64,224" fill="none" stroke="black" />
  <path d="M 80,208 A 16,16 0 0,1 96,224" fill="none" stroke="black" />
  <path d="M 144,208 A 16,16 0 0,0 128,224" fill="none" stroke="black" />
  <path d="M 144,208 A 16,16 0 0,1 160,224" fill="none" stroke="black" />
  <path d="M 208,208 A 16,16 0 0,0 192,224" fill="none" stroke="black" />
  <path d="M 208,208 A 16,16 0 0,1 224,224" fill="none" stroke="black" />
  <path d="M 272,208 A 16,16 0 0,0 256,224" fill="none" stroke="black" />
  <path d="M 272,208 A 16,16 0 0,1 288,224" fill="none" stroke="black" />
  <path d="M 336,208 A 16,16 0 0,0 320,224" fill="none" stroke="black" />
  <path d="M 336,208 A 16,16 0 0,1 352,224" fill="none" stroke="black" />
  <path d="M 400,208 A 16,16 0 0,0 384,224" fill="none" stroke="black" />
  <path d="M 400,208 A 16,16 0 0,1 416,224" fill="none" stroke="black" />
  <path d="M 464,208 A 16,16 0 0,0 448,224" fill="none" stroke="black" />
  <path d="M 464,208 A 16,16 0 0,1 480,224" fill="none" stroke="black" />
  <path d="M 0,224 A 16,16 0 0,0 16,240" fill="none" stroke="black" />
  <path d="M 32,224 A 16,16 0 0,1 16,240" fill="none" stroke="black" />
  <path d="M 64,224 A 16,16 0 0,0 80,240" fill="none" stroke="black" />
  <path d="M 96,224 A 16,16 0 0,1 80,240" fill="none" stroke="black" />
  <path d="M 128,224 A 16,16 0 0,0 144,240" fill="none" stroke="black" />
  <path d="M 160,224 A 16,16 0 0,1 144,240" fill="none" stroke="black" />
  <path d="M 192,224 A 16,16 0 0,0 208,240" fill="none" stroke="black" />
  <path d="M 224,224 A 16,16 0 0,1 208,240" fill="none" stroke="black" />
  <path d="M 256,224 A 16,16 0 0,0 272,240" fill="none" stroke="black" />
  <path d="M 288,224 A 16,16 0 0,1 272,240" fill="none" stroke="black" />
  <path d="M 320,224 A 16,16 0 0,0 336,240" fill="none" stroke="black" />
  <path d="M 352,224 A 16,16 0 0,1 336,240" fill="none" stroke="black" />
  <path d="M 384,224 A 16,16 0 0,0 400,240" fill="none" stroke="black" />
  <path d="M 416,224 A 16,16 0 0,1 400,240" fill="none" stroke="black" />
  <path d="M 448,224 A 16,16 0 0,0 464,240" fill="none" stroke="black" />
  <path d="M 480,224 A 16,16 0 0,1 464,240" fill="none" stroke="black" />
  <text text-anchor="middle" font-family="sans-serif" x="400" y="260">1</text>
  <text text-anchor="middle" font-family="sans-serif" x="320" y="260">0</text>
  <text text-anchor="middle" font-family="sans-serif" x="328" y="260">1</text>
  <text text-anchor="middle" font-family="sans-serif" x="336" y="228">5</text>
  <text text-anchor="middle" font-family="sans-serif" x="392" y="260">1</text>
  <text text-anchor="middle" font-family="sans-serif" x="144" y="260">1</text>
  <text text-anchor="middle" font-family="sans-serif" x="152" y="260">0</text>
  <text text-anchor="middle" font-family="sans-serif" x="384" y="260">0</text>
  <text text-anchor="middle" font-family="sans-serif" x="448" y="260">0</text>
  <text text-anchor="middle" font-family="sans-serif" x="400" y="228">6</text>
  <text text-anchor="middle" font-family="sans-serif" x="128" y="260">0</text>
  <text text-anchor="middle" font-family="sans-serif" x="216" y="260">1</text>
  <text text-anchor="middle" font-family="sans-serif" x="264" y="260">1</text>
  <text text-anchor="middle" font-family="sans-serif" x="344" y="260">1</text>
  <text text-anchor="middle" font-family="sans-serif" x="464" y="20">7</text>
  <text text-anchor="middle" font-family="sans-serif" x="136" y="260">0</text>
  <text text-anchor="middle" font-family="sans-serif" x="16" y="228">0</text>
  <text text-anchor="middle" font-family="sans-serif" x="272" y="260">0</text>
  <text text-anchor="middle" font-family="sans-serif" x="464" y="260">1</text>
  <text text-anchor="middle" font-family="sans-serif" x="80" y="148">1</text>
  <text text-anchor="middle" font-family="sans-serif" x="208" y="148">3</text>
  <text text-anchor="middle" font-family="sans-serif" x="16" y="260">0</text>
  <text text-anchor="middle" font-family="sans-serif" x="24" y="260">0</text>
  <text text-anchor="middle" font-family="sans-serif" x="64" y="260">0</text>
  <text text-anchor="middle" font-family="sans-serif" x="72" y="260">0</text>
  <text text-anchor="middle" font-family="sans-serif" x="192" y="260">0</text>
  <text text-anchor="middle" font-family="sans-serif" x="280" y="260">0</text>
  <text text-anchor="middle" font-family="sans-serif" x="208" y="228">3</text>
  <text text-anchor="middle" font-family="sans-serif" x="0" y="260">0</text>
  <text text-anchor="middle" font-family="sans-serif" x="456" y="260">1</text>
  <text text-anchor="middle" font-family="sans-serif" x="336" y="260">0</text>
  <text text-anchor="middle" font-family="sans-serif" x="408" y="260">0</text>
  <text text-anchor="middle" font-family="sans-serif" x="464" y="148">7</text>
  <text text-anchor="middle" font-family="sans-serif" x="80" y="228">1</text>
  <text text-anchor="middle" font-family="sans-serif" x="144" y="228">2</text>
  <text text-anchor="middle" font-family="sans-serif" x="272" y="228">4</text>
  <text text-anchor="middle" font-family="sans-serif" x="464" y="228">7</text>
  <text text-anchor="middle" font-family="sans-serif" x="8" y="260">0</text>
  <text text-anchor="middle" font-family="sans-serif" x="208" y="84">3</text>
  <text text-anchor="middle" font-family="sans-serif" x="464" y="84">7</text>
  <text text-anchor="middle" font-family="sans-serif" x="208" y="260">1</text>
  <text text-anchor="middle" font-family="sans-serif" x="472" y="260">1</text>
  <text text-anchor="middle" font-family="sans-serif" x="88" y="260">1</text>
  <text text-anchor="middle" font-family="sans-serif" x="200" y="260">0</text>
  <text text-anchor="middle" font-family="sans-serif" x="256" y="260">0</text>
  <text text-anchor="middle" font-family="sans-serif" x="336" y="148">5</text>
  <text text-anchor="middle" font-family="sans-serif" x="80" y="260">0</text>
</g></svg>
</artwork>
</figure>
<t>An algorithm for efficiently calculating the immediately preceding apex is provided in Appendix C.</t>
</section>
<section title="Position Index" anchor="n-position-index"><t>Contains a table of frame number, position pairs pointing to prior locations in the file.</t>
</section>
<section title="Metadata Index" anchor="n-metadata-index"><t>Contains a list of IndexMeta entries. Each entry contains a metadata description and a list of frame indexes (not positions) of frames that match the description.</t>
</section>
</section>
<section title="Integrity Mechanisms" anchor="n-integrity-mechanisms"><t>Frame sequences in a DARE container <bcp14>MAY</bcp14> be protected against a frame insertion attack by means of a digest chain, a binary Merkle tree or both.</t>
<section title="Digest Chain calculation" anchor="n-digest-chain-calculation"><t>A digest chain is simple to implement but can only be verified if the full chain of values is known. Appending a frame to the chain has <em>O(1)</em> complexity but verification has <em>O(n)</em> complexity:</t>
<figure>
<name>
Hash chain integrity check</name>
<!-- Include SVG File ../Images/DAREhashchain.svg --><artwork type="svg">
<svg width="568" height="57" xmlns="http://www.w3.org/2000/svg" >
<g transform="translate(8,16)">
  <path d="M 32,16 L 64,16" fill="none" stroke="black" />
  <path d="M 104,16 L 136,16" fill="none" stroke="black" />
  <path d="M 176,16 L 208,16" fill="none" stroke="black" />
  <path d="M 248,16 L 280,16" fill="none" stroke="black" />
  <path d="M 320,16 L 352,16" fill="none" stroke="black" />
  <path d="M 392,16 L 424,16" fill="none" stroke="black" />
  <path d="M 464,16 L 496,16" fill="none" stroke="black" />
  <path d="M 536,16 L 552,16" fill="none" stroke="black" />
  <polygon points="72.000000,16.000000 60.000000,10.400000 60.000000,21.600000" fill="black" transform="rotate(0.000000, 64.000000, 16.000000)" />
  <polygon points="144.000000,16.000000 132.000000,10.400000 132.000000,21.600000" fill="black" transform="rotate(0.000000, 136.000000, 16.000000)" />
  <polygon points="216.000000,16.000000 204.000000,10.400000 204.000000,21.600000" fill="black" transform="rotate(0.000000, 208.000000, 16.000000)" />
  <polygon points="288.000000,16.000000 276.000000,10.400000 276.000000,21.600000" fill="black" transform="rotate(0.000000, 280.000000, 16.000000)" />
  <polygon points="360.000000,16.000000 348.000000,10.400000 348.000000,21.600000" fill="black" transform="rotate(0.000000, 352.000000, 16.000000)" />
  <polygon points="432.000000,16.000000 420.000000,10.400000 420.000000,21.600000" fill="black" transform="rotate(0.000000, 424.000000, 16.000000)" />
  <polygon points="504.000000,16.000000 492.000000,10.400000 492.000000,21.600000" fill="black" transform="rotate(0.000000, 496.000000, 16.000000)" />
  <path d="M 16,0 A 16,16 0 0,0 0,16" fill="none" stroke="black" />
  <path d="M 16,0 A 16,16 0 0,1 32,16" fill="none" stroke="black" />
  <path d="M 88,0 A 16,16 0 0,0 72,16" fill="none" stroke="black" />
  <path d="M 88,0 A 16,16 0 0,1 104,16" fill="none" stroke="black" />
  <path d="M 160,0 A 16,16 0 0,0 144,16" fill="none" stroke="black" />
  <path d="M 160,0 A 16,16 0 0,1 176,16" fill="none" stroke="black" />
  <path d="M 232,0 A 16,16 0 0,0 216,16" fill="none" stroke="black" />
  <path d="M 232,0 A 16,16 0 0,1 248,16" fill="none" stroke="black" />
  <path d="M 304,0 A 16,16 0 0,0 288,16" fill="none" stroke="black" />
  <path d="M 304,0 A 16,16 0 0,1 320,16" fill="none" stroke="black" />
  <path d="M 376,0 A 16,16 0 0,0 360,16" fill="none" stroke="black" />
  <path d="M 376,0 A 16,16 0 0,1 392,16" fill="none" stroke="black" />
  <path d="M 448,0 A 16,16 0 0,0 432,16" fill="none" stroke="black" />
  <path d="M 448,0 A 16,16 0 0,1 464,16" fill="none" stroke="black" />
  <path d="M 520,0 A 16,16 0 0,0 504,16" fill="none" stroke="black" />
  <path d="M 520,0 A 16,16 0 0,1 536,16" fill="none" stroke="black" />
  <path d="M 0,16 A 16,16 0 0,0 16,32" fill="none" stroke="black" />
  <path d="M 32,16 A 16,16 0 0,1 16,32" fill="none" stroke="black" />
  <path d="M 72,16 A 16,16 0 0,0 88,32" fill="none" stroke="black" />
  <path d="M 104,16 A 16,16 0 0,1 88,32" fill="none" stroke="black" />
  <path d="M 144,16 A 16,16 0 0,0 160,32" fill="none" stroke="black" />
  <path d="M 176,16 A 16,16 0 0,1 160,32" fill="none" stroke="black" />
  <path d="M 216,16 A 16,16 0 0,0 232,32" fill="none" stroke="black" />
  <path d="M 248,16 A 16,16 0 0,1 232,32" fill="none" stroke="black" />
  <path d="M 288,16 A 16,16 0 0,0 304,32" fill="none" stroke="black" />
  <path d="M 320,16 A 16,16 0 0,1 304,32" fill="none" stroke="black" />
  <path d="M 360,16 A 16,16 0 0,0 376,32" fill="none" stroke="black" />
  <path d="M 392,16 A 16,16 0 0,1 376,32" fill="none" stroke="black" />
  <path d="M 432,16 A 16,16 0 0,0 448,32" fill="none" stroke="black" />
  <path d="M 464,16 A 16,16 0 0,1 448,32" fill="none" stroke="black" />
  <path d="M 504,16 A 16,16 0 0,0 520,32" fill="none" stroke="black" />
  <path d="M 536,16 A 16,16 0 0,1 520,32" fill="none" stroke="black" />
  <text text-anchor="middle" font-family="sans-serif" x="376" y="20">5</text>
  <text text-anchor="middle" font-family="sans-serif" x="448" y="20">6</text>
  <text text-anchor="middle" font-family="sans-serif" x="520" y="20">7</text>
  <text text-anchor="middle" font-family="sans-serif" x="16" y="20">0</text>
  <text text-anchor="middle" font-family="sans-serif" x="88" y="20">1</text>
  <text text-anchor="middle" font-family="sans-serif" x="160" y="20">2</text>
  <text text-anchor="middle" font-family="sans-serif" x="232" y="20">3</text>
  <text text-anchor="middle" font-family="sans-serif" x="304" y="20">4</text>
</g></svg>
</artwork>
</figure>
<t>The value of the chain digest for the first frame (frame 0) is <em>H(H(null)+H(Payload<sub>0</sub>)), where null is a zero length octet sequence and payloadn is the sequence of payload data bytes for frame n</em></t>
<t>The value of the chain digest for frame <em>n</em> is <em>H(H(Payload<sub>n-1</sub> + H(Payloadn)), where A+B stands for concatenation of the byte sequences A and B.</em></t>
</section>
<section title="Binary Merkle tree calculation" anchor="n-binary-merkle-tree-calculation"><t>The tree index mechanism describe earlier may be used to implement a binary Merkle tree. The value TreeDigest specifies the apex value of the tree for that node.</t>
<t>Appending a frame to the chain has <em>O(log<sub>2</sub> (n)) complexity provided that the container format supports at least the binary tree index. Verifying a chain has O(log2 (n)) complexity, provided that the set of necessary digest inputs is known.</em></t>
<t>To calculate the value of the tree digest for a node, we first calculate the values of all the sub trees that have their apex at that node and then calculate the digest of that value and the immediately preceding local apex.</t>
</section>
<section title="Signature" anchor="n-signature-1"><t>Payload data <bcp14>MAY</bcp14> be signed using a JWS <xref target="RFC7515"></xref> as applied in the Envelope.</t>
<t>Signatures are specified by the <tt>Signatures</tt> parameter in the content header. The data that the signature is calculated over is defined by the typ parameter of the Signature as follows.</t>
<dl>
<dt><tt>Payload</tt></dt>
<dd>
<t>The value of the <tt>PayloadDigest</tt> parameter</t>
</dd>
<dt><tt>Chain</tt></dt>
<dd>
<t>The value of the <tt>ChainDigest</tt> parameter</t>
</dd>
<dt><tt>Tree</tt></dt>
<dd>
<t>The value of the <tt>TreeDigestFinal</tt> parameter</t>
</dd>
</dl>
<t>If the <tt>typ</tt> parameter is absent, the value Payload is implied.</t>
<t>A frame <bcp14>MAY</bcp14> contain multiple signatures created with the same signing key and different typ values.</t>
<t>The use of signatures over chain and tree digest values permits multiple frames to be validated using a single signature verification operation.</t>
</section>
</section>
</section>
<section title="Dare Sequence Applications" anchor="n-dare-sequence-applications"><t>DARE Sequences are used to implement two forms of persistence store to support Mesh operations:</t>
<dl>
<dt>Catalogs</dt>
<dd>
<t>A set of related items which <bcp14>MAY</bcp14> be added, modified or deleted at any time.</t>
</dd>
<dt>Spools</dt>
<dd>
<t>A list of related items whose status <bcp14>MAY</bcp14> be changed at any time but which are immutable once added.</t>
</dd>
</dl>
<t>Since DARE Sequences are an append only log format, entries can only be modified or deleted by adding items to the log to change the status of previous entries. It is always possible to undo any operation on a catalog or spool unless the underlying container is purged or the individual entries modified.</t>
<section title="Catalog" anchor="n-catalog"><t>Catalogs contain a set of entries, each of which is distinguished by a unique identifier.</t>
<t>Three operations are supported:</t>
<dl>
<dt>Add</dt>
<dd>
<t>Addition of the entry to the catalog</t>
</dd>
<dt>Update</dt>
<dd>
<t>Modification of the data associated with the entry excluding the identifier</t>
</dd>
<dt>Delete</dt>
<dd>
<t>Removal of the entry from the catalog</t>
</dd>
</dl>
<t>The set of valid state transitions is defined by the Finite State machine:</t>
<t>(Add-Update*-Delete)*</t>
<t>Catalogs are used to represent sets of persistent objects associated with a Mesh Service Account. The user's set of contacts for example. Each contact entry may be modified many times over time but refers to the same subject for its entire lifetime.</t>
</section>
<section title="Spool" anchor="n-spool"><t>Spools contain lists of entries, each of which is distinguished by a unique identifier.</t>
<t>Four operations are supported:</t>
<dl>
<dt>Post</dt>
<dd>
<t>Addition of the entry to the spool</t>
</dd>
<dt>Processed</dt>
<dd>
<t>Marks the entry as having been processed.</t>
</dd>
<dt>Unprocessed</dt>
<dd>
<t>Returns the entry to the unread state.</t>
</dd>
<dt>Delete</dt>
<dd>
<t>Mark the entry as deleted allowing recovery of associated storage in a subsequent purge operation.</t>
</dd>
</dl>
<t>The set of valid state transitions is defined by the Finite State machine:</t>
<t>Post-(Processed| Unprocessed| Delete *)</t>
<t>Spools are used to represent time sequence ordered entries such as lists of messages being sent or received, task queues and transaction logs.</t>
</section>
<section title="Archive" anchor="n-archive"><t>A DARE Archive is a DARE Sequence whose entries contain files. This affords the same functionality as a traditional ZIP or tar archive but with the added cryptographic capabilities provided by the DARE format.</t>
</section>
</section>
<section title="Future Work" anchor="n-future-work"><t>The current specification describes an approach in which containers are written according to a strict append-only policy. Greater flexibility may be achieved by loosening this requirement allowing record(s) at the end of the container to be overwritten.</t>
<section title="Terminal integrity check" anchor="n-terminal-integrity-check"><t>A major concern when operating a critical service is the possibility of a hardware or power failure occurring during a write operation causing the file update to be incomplete. While most modern operating systems have effective mechanisms in place to prevent corruption of the file system itself in such circumstances, this does not provide sufficient protection at the application level.</t>
<t>Appending a null record containing a container-specific magic number provides an effective means of detecting this circumstance that can be quickly verified.</t>
<t>If a container specifies a terminal integrity check value in the header of frame zero, the container is considered to be in an incomplete write state if the final frame is not a null record specifying the magic number.</t>
<t>When appending new records to such containers, the old terminal integrity check record is overwritten by the data being added and a new integrity check record appended to the end.</t>
</section>
<section title="Terminal index record" anchor="n-terminal-index-record"><t>A writer can maintain a complete (or partial) index of the container in its final record without additional space overhead by overwriting the prior index on each update.</t>
</section>
<section title="Deferred indexing" anchor="n-deferred-indexing"><t>The task of updating terminal indexes may be deferred to a time when the machine is not busy. This improves responsiveness and may avoid the need to re-index containers receiving a sequence of updates.</t>
<t>This approach may be supported by appending new entries to the end of the container in the usual fashion and maintaining a record of containers to be updated as a separate task.</t>
<t>When updating the index on a container that has been updated in this fashion, the writer must ensure that no data is lost even if the process is interrupted. The use of guard records and other precautions against loss of state is advised. </t>
</section>
</section>
<section title="Security Considerations" anchor="n-security-considerations"><t>This section describes security considerations arising from the use of DARE in general applications.</t>
<t>Additional security considerations for use of DARE in Mesh services and applications are described in the Mesh Security Considerations guide <xref target="draft-hallambaker-mesh-security"></xref>.</t>
<section title="Encryption/Signature nesting" anchor="n-encryptionsignature-nesting"></section>
<section title="Side channel" anchor="n-side-channel"></section>
<section title="Salt reuse" anchor="n-salt-reuse"></section>
</section>
<section title="IANA Considerations" anchor="n-iana-considerations"></section>
<section title="Acknowledgements" anchor="n-acknowledgements"><t>A list of people who have contributed to the design of the Mesh is presented in <xref target="draft-hallambaker-mesh-architecture"></xref>.</t>
<t>The name Data At Rest Encryption was proposed by Melhi Abdulhayo?lu.</t>
</section>
<section title="Appendix A: DARE Envelope Examples and Test Vectors" anchor="n-appendix-a-dare-envelope-examples-and-test-vectors"></section>
<section title="Test Examples" anchor="n-test-examples-"><t>In the following examples, Alice's encryption private key parameters are: </t>
<sourcecode>{
  "PrivateKeyECDH":{
    "Private":"nwl9iSSW2OyJf2Pf5kNt7EqNKCpE6uxdmY_46a8SGUA",
    "crv":"Ed25519"}}</sourcecode>
<t>Alice's signature private key parameters are: </t>
<sourcecode>{
  "PrivateKeyECDH":{
    "Private":"TDuiCw36Z9tFE65-5wImmDqIZv8AsY6TBTkNQuxVxbU",
    "crv":"Ed25519"}}</sourcecode>
<t>The body of the test message is the UTF8 representation of the following string: </t>
<sourcecode>"This is a test long enough to require multiple blocks"</sourcecode>
<t>The EDS sequences, are the UTF8 representation of the following strings: </t>
<sourcecode>"Subject: Message metadata should be encrypted"
"2018-02-01"</sourcecode>
<section title="Plaintext Message" anchor="n--plaintext-message-"><t>A plaintext message without associated EDS sequences is an empty header followed by the message body: </t>
<sourcecode>{
  "DareEnvelope":[{},
    "VGhpcyBpcyBhIHRlc3QgbG9uZyBlbm91Z2ggdG8gcmVxdWlyZSBtdWx0aXBs
  ZSBibG9ja3M"
    ]}</sourcecode>
</section>
<section title="Plaintext Message with EDS" anchor="n--plaintext-message-with-eds-"><t>If a plaintext message contains EDS sequences, these are also in plaintext: </t>
<sourcecode>{
  "DareEnvelope":[{
      "annotations":["iAEAiC1TdWJqZWN0OiBNZXNzYWdlIG1ldGFkYXRhIHNo
  b3VsZCBiZSBlbmNyeXB0ZWQ",
        "iAEBiAoyMDE4LTAyLTAx"
        ]},
    "VGhpcyBpcyBhIHRlc3QgbG9uZyBlbm91Z2ggdG8gcmVxdWlyZSBtdWx0aXBs
  ZSBibG9ja3M"
    ]}</sourcecode>
</section>
<section title="Encrypted Message" anchor="n--encrypted-message-"><t>The creator generates a base seed: </t>
<sourcecode>
  D4 B9 0B 18  8F 3B 1A 86  E9 6D B6 17  78 5B 03 41
  10 B5 63 0D  A7 4E F1 A4  25 76 B2 7C  48 EA D3 F1</sourcecode>
<t>For each recipient of the message: </t>
<t>The creator generates an ephemeral key: </t>
<sourcecode>{
  "PrivateKeyECDH":{
    "Private":"BbKvZPQspjv5bSySWxU86cnf5VCuJsN-vF6XQSnn2pc",
    "crv":"Ed25519"}}</sourcecode>
<t>The key agreement value is calculated: </t>
<sourcecode>
  C7 08 8B 11  B8 1C 6B F5  04 72 7E 54  91 35 24 01
  E3 0D 00 4D  C3 4F 8A A1  E0 8F 87 BE  F9 F8 F8 1E</sourcecode>
<t>The key agreement value is used as the input to a HKDF key derivation function with the info parameter  master to create the key used to wrap the base seed: </t>
<sourcecode>
  34 75 34 87  C8 B9 FC B5  76 8F 20 F4  0F 10 BF BE
  E3 EB 48 CD  5F A5 4B 0C  5E DC 62 FD  77 24 D7 42</sourcecode>
<t>The wrapped base seed is: </t>
<sourcecode>
  42 39 2E E6  5D 20 8A 51  C5 B5 4E 1D  6E 62 F5 BA
  AD C1 00 26  33 E6 4B 64  2B E3 9A F4  46 5D 2F 40
  70 E0 AA F5  E1 3F 93 16</sourcecode>
<t>This information is used to calculate the Recipient information shown in the example below. </t>
<t>To encrypt a message, we first generate a unique salt value: </t>
<sourcecode>
  C7 F9 65 E4  91 29 70 39  B9 04 BF 2A  7B 1F 38 B4</sourcecode>
<t>The base seed and salt value are used to generate the payload encryption key: </t>
<sourcecode>
  5E 9A 43 79  3E 0F 89 65  C4 C0 F4 80  9B 46 14 05
  BB 2D 6D 91  73 75 B7 77  70 5E 1C 78  63 2E 74 48</sourcecode>
<t>Since AES is a block cipher, we also require an initializarion vector: </t>
<sourcecode>
  D1 B3 40 5D  DA 4C 1F 91  9B B3 83 99  24 B2 83 FD</sourcecode>
<t>The output sequence is the encrypted bytes: </t>
<sourcecode>
  C0 03 21 7D  46 D4 0E C5  49 6E 42 DB  DD D2 D3 06
  CD DC F7 F2  DF 00 08 8C  5D 54 F2 C5  68 68 CC FB
  72 16 F1 B3  1D 21 2A 8D  77 5B D1 E9  BA B0 A6 9F
  2E 72 1A 20  DE 5F 47 EB  16 3F 75 FD  D8 E5 28 39</sourcecode>
<t>Since the message is not signed, there is no need for a trailer. The completed message is: </t>
<sourcecode>{
  "DareEnvelope":[{
      "enc":"A256CBC",
      "kid":"EBQF-CP73-F3CX-HX54-PIFU-4C4J-IYVL",
      "Salt":"x_ll5JEpcDm5BL8qex84tA",
      "recipients":[{
          "kid":"MC3P-SEXC-G5NY-LUUQ-CDZU-JZTN-HMPX",
          "epk":{
            "PublicKeyECDH":{
              "crv":"Ed25519",
              "Public":"7XeOpwiT_2seIbUB5B4pvWuW__ZSiaU6dOlrGil9V
  oo"}},
          "wmk":"VLz73UJQNX5uxxVaCWe5Df3ecbbnTcVsXOIcEam0zMQvcnpW
  f2Fkhw"}
        ]},
    "wAMhfUbUDsVJbkLb3dLTBs3c9_LfAAiMXVTyxWhozPtyFvGzHSEqjXdb0em6
  sKafLnIaIN5fR-sWP3X92OUoOQ"
    ]}</sourcecode>
</section>
<section title="Signed Message" anchor="n--signed-message-"><t>Signed messages specify the digest algorithm to be used in the header and the signature value in the trailer. Note that the digest algorithm is not optional since it serves as notice that a decoder should digest the payload value  to enable signature verification. </t>
<sourcecode>{
  "DareEnvelope":[{
      "dig":"S512"},
    "VGhpcyBpcyBhIHRlc3QgbG9uZyBlbm91Z2ggdG8gcmVxdWlyZSBtdWx0aXBs
  ZSBibG9ja3M",
    {
      "signatures":[{
          "alg":"ED25519",
          "kid":"MBXV-TFAE-W2F4-MD2J-RTSC-BI5S-RZOF",
          "signature":"oTA-FtWVxbm3aPEMy7vQN-QamBXArpZn-yIpiEKlck
  J5wi-EqCzVqPxhutqiX7iBvBaunTiE-zSXjLXqM_O_AQ"}
        ],
      "PayloadDigest":"raim8SV5adPbWWn8FMM4mrRAQCO9A2jZ0NZAnFXWlG
  0xF6sWGJbnKSdtIJMmMU_hjarlIPEoY3vy9UdVlH5KAg"}
    ]}</sourcecode>
</section>
<section title="Signed and Encrypted Message" anchor="n--signed-and-encrypted-message-"><t>A signed and encrypted message is encrypted and then signed. The signer proves knowledge of the payload plaintext by providing the plaintext witness value. </t>
<sourcecode>{
  "DareEnvelope":[{
      "enc":"A256CBC",
      "kid":"EBQI-SSBW-XXYI-KCQ6-UXOY-XPQO-4ECY",
      "Salt":"8eHpXI3SRWuTwiTt0FrdMA",
      "recipients":[{
          "kid":"MC3P-SEXC-G5NY-LUUQ-CDZU-JZTN-HMPX",
          "epk":{
            "PublicKeyECDH":{
              "crv":"Ed25519",
              "Public":"6-olHQrajRUZK7atlKCzdvPzJ3_fAzLB0JuBRtIcb
  6E"}},
          "wmk":"K7_uKzUucBDsGOuZNAn5MwefO0BVBbInkojiMr4ruE1Z8Yiy
  u3abeA"}
        ],
      "dig":"S512"},
    "uAazLEvBwoZiSlLn_gDf9ZDM74g-yoTnONmmng732bkL07S8XeNqqqFRy7d6
  4EI6vNkK96fW0n_x9iqAFSMDFg",
    {
      "signatures":[{
          "alg":"ED25519",
          "kid":"MBXV-TFAE-W2F4-MD2J-RTSC-BI5S-RZOF",
          "signature":"60Y8PwAR7nRx7HM79gv-4K3woMEF2h-51-3fkZDaGM
  bbqxjsaKPUob4PCPdU-lKZD6HA9Iy1xLGxEX8ZW7cWAg"}
        ],
      "WitnessValue":"dRRwO0Kts0gPBENC6ZEQVncJekLBPPQwmetMJLoL4yA",
      "PayloadDigest":"UrXB6S1YgWIkIcl6kJq9IqsSBgyjnruxiWYEca8NQ7
  Evnd1wZ77UG7AhLaTaR2GCwWfcEU9Kfnnms-cV7e51CA"}
    ]}</sourcecode>
</section>
</section>
<section title="Appendix B: DARE Sequence Examples and Test Vectors" anchor="n-appendix-b-dare-sequence-examples-and-test-vectors"><t>The data payloads in all the following examples are identical, only the authentication and/or encryption is different.  </t>
<ul>
<li> Frame 1..n consists of 300 bytes being the byte sequence 00, 01, 02, etc.  repeating after 256 bytes. </li>
</ul>
<t>For conciseness, the raw data format is omitted for examples after the first, except where the data payload has been transformed, (i.e. encrypted). </t>
<section title="Simple sequence" anchor="n-simple-sequence-"><t>The following example shows a simple sequence with first frame and a single data frame: </t>
<t>Since there is no integrity check, there is no need for trailer entries. The header values are: </t>
<t>Frame 0 </t>
<sourcecode>{
  "DareHeader":{
    "policy":{},
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "DataEncoding":"JSON",
      "ContainerType":"List",
      "Index":0}}}

[Empty trailer]</sourcecode>
<t>Frame 0 </t>
<sourcecode>{
  "DareHeader":{
    "policy":{},
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "DataEncoding":"JSON",
      "ContainerType":"List",
      "Index":0}}}

[Empty trailer]</sourcecode>
<t>Frame 1 </t>
<sourcecode>{
  "DareHeader":{
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "Index":1}}}

[Empty trailer]</sourcecode>
</section>
<section title="Payload and chain digests" anchor="n-payload-and-chain-digests-"><t>The following example shows a chain sequence with a first frame and three  data frames. The headers of these frames is the same as before but the frames now have trailers specifying the PayloadDigest and ChainDigest values: </t>
<t>Frame 0 </t>
<sourcecode>{
  "DareHeader":{
    "policy":{},
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "DataEncoding":"JSON",
      "ContainerType":"Chain",
      "Index":0},
    "dig":"S512"}}

[Empty trailer]</sourcecode>
<t>Frame 0 </t>
<sourcecode>{
  "DareHeader":{
    "policy":{},
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "DataEncoding":"JSON",
      "ContainerType":"Chain",
      "Index":0},
    "dig":"S512"}}

{
  "DareTrailer":{
    "PayloadDigest":"z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg_SpIdNs6c5H
  0NE8XYXysP-DGNKHfuwvY7kxvUdBeoGlODJ6-SfaPg",
    "ChainDigest":"FEHy24Y6cLModDXWH31kVc2a3TdhjXPooKHpLAb2JbsO1Y
  QnJolmowXAYHhkOGY0kg3jrKNTjds0myf4Dw1sdg"}}</sourcecode>
<t>Frame 1 </t>
<sourcecode>{
  "DareHeader":{
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "Index":1},
    "dig":"S512"}}

{
  "DareTrailer":{
    "PayloadDigest":"8dyi62d7MDJlsLm6_w4GEgKBjzXBRwppu6qbtmAl6UjZ
  DlZeaWQlBsYhOu88-ekpNXpZ2iY96zTRI229zaJ5sw",
    "ChainDigest":"T7S1FcrgY3AaWD4L-t5W1K-3XYkPTcOdGEGyjglTD6yMYV
  RVz9tn_KQc6GdA-P4VSRigBygV65OEd2Vv3YDhww"}}</sourcecode>
<t>Frame 2 </t>
<sourcecode>{
  "DareHeader":{
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "Index":2},
    "dig":"S512"}}

{
  "DareTrailer":{
    "PayloadDigest":"8dyi62d7MDJlsLm6_w4GEgKBjzXBRwppu6qbtmAl6UjZ
  DlZeaWQlBsYhOu88-ekpNXpZ2iY96zTRI229zaJ5sw",
    "ChainDigest":"T7S1FcrgY3AaWD4L-t5W1K-3XYkPTcOdGEGyjglTD6yMYV
  RVz9tn_KQc6GdA-P4VSRigBygV65OEd2Vv3YDhww"}}</sourcecode>
<t>Frame 3 </t>
<sourcecode>{
  "DareHeader":{
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "Index":3},
    "dig":"S512"}}

{
  "DareTrailer":{
    "PayloadDigest":"8dyi62d7MDJlsLm6_w4GEgKBjzXBRwppu6qbtmAl6UjZ
  DlZeaWQlBsYhOu88-ekpNXpZ2iY96zTRI229zaJ5sw",
    "ChainDigest":"T7S1FcrgY3AaWD4L-t5W1K-3XYkPTcOdGEGyjglTD6yMYV
  RVz9tn_KQc6GdA-P4VSRigBygV65OEd2Vv3YDhww"}}</sourcecode>
</section>
<section title="Merkle Tree" anchor="n-merkle-tree-"><t>The following example shows a chain sequence with a first frame and six  data frames. The trailers now contain the TreePosition and TreeDigest values: </t>
<t>Frame 0 </t>
<sourcecode>{
  "DareHeader":{
    "policy":{},
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "DataEncoding":"JSON",
      "ContainerType":"Merkle",
      "Index":0},
    "dig":"S512"}}

[Empty trailer]</sourcecode>
<t>Frame 0 </t>
<sourcecode>{
  "DareHeader":{
    "policy":{},
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "DataEncoding":"JSON",
      "ContainerType":"Merkle",
      "Index":0},
    "dig":"S512"}}

{
  "DareTrailer":{
    "PayloadDigest":"z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg_SpIdNs6c5H
  0NE8XYXysP-DGNKHfuwvY7kxvUdBeoGlODJ6-SfaPg",
    "ApexDigest":"wvk8X5vTHUlVff7cj3k6fHBqXw52PA_7KK5zRLkheMKnGVF
  gHY0VL46Fz78rIjCnSNGXmDoBBG5phZRCU1guDA"}}</sourcecode>
<t>Frame 1 </t>
<sourcecode>{
  "DareHeader":{
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "Index":1,
      "TreePosition":0},
    "dig":"S512"}}

{
  "DareTrailer":{
    "PayloadDigest":"8dyi62d7MDJlsLm6_w4GEgKBjzXBRwppu6qbtmAl6UjZ
  DlZeaWQlBsYhOu88-ekpNXpZ2iY96zTRI229zaJ5sw",
    "ApexDigest":"vJ6ngNATvZcXSMALi5IUqzl1GBxBnTNVcC87VL_BhMRCbAv
  KSj8gs0VFgxxLkZ2myrtaDIwhHoswiTiBMLNWug"}}</sourcecode>
<t>Frame 2 </t>
<sourcecode>{
  "DareHeader":{
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "Index":2,
      "TreePosition":392},
    "dig":"S512"}}

{
  "DareTrailer":{
    "PayloadDigest":"8dyi62d7MDJlsLm6_w4GEgKBjzXBRwppu6qbtmAl6UjZ
  DlZeaWQlBsYhOu88-ekpNXpZ2iY96zTRI229zaJ5sw",
    "ApexDigest":"T7S1FcrgY3AaWD4L-t5W1K-3XYkPTcOdGEGyjglTD6yMYVR
  Vz9tn_KQc6GdA-P4VSRigBygV65OEd2Vv3YDhww"}}</sourcecode>
<t>Frame 3 </t>
<sourcecode>{
  "DareHeader":{
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "Index":3,
      "TreePosition":392},
    "dig":"S512"}}

{
  "DareTrailer":{
    "PayloadDigest":"8dyi62d7MDJlsLm6_w4GEgKBjzXBRwppu6qbtmAl6UjZ
  DlZeaWQlBsYhOu88-ekpNXpZ2iY96zTRI229zaJ5sw",
    "ApexDigest":"7fHmkEIsPkN6sDYAOLvpIJn5Dg3PxDDAaq-ll2kh8722kok
  kFnZQcYtjuVC71aHNXI18q-lPnfRkmwryG-bhqQ"}}</sourcecode>
<t>Frame 4 </t>
<sourcecode>{
  "DareHeader":{
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "Index":4,
      "TreePosition":1676},
    "dig":"S512"}}

{
  "DareTrailer":{
    "PayloadDigest":"8dyi62d7MDJlsLm6_w4GEgKBjzXBRwppu6qbtmAl6UjZ
  DlZeaWQlBsYhOu88-ekpNXpZ2iY96zTRI229zaJ5sw",
    "ApexDigest":"T7S1FcrgY3AaWD4L-t5W1K-3XYkPTcOdGEGyjglTD6yMYVR
  Vz9tn_KQc6GdA-P4VSRigBygV65OEd2Vv3YDhww"}}</sourcecode>
<t>Frame 5 </t>
<sourcecode>{
  "DareHeader":{
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "Index":5,
      "TreePosition":1676},
    "dig":"S512"}}

{
  "DareTrailer":{
    "PayloadDigest":"8dyi62d7MDJlsLm6_w4GEgKBjzXBRwppu6qbtmAl6UjZ
  DlZeaWQlBsYhOu88-ekpNXpZ2iY96zTRI229zaJ5sw",
    "ApexDigest":"vJ6ngNATvZcXSMALi5IUqzl1GBxBnTNVcC87VL_BhMRCbAv
  KSj8gs0VFgxxLkZ2myrtaDIwhHoswiTiBMLNWug"}}</sourcecode>
<t>Frame 6 </t>
<sourcecode>{
  "DareHeader":{
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "Index":6,
      "TreePosition":2963},
    "dig":"S512"}}

{
  "DareTrailer":{
    "PayloadDigest":"8dyi62d7MDJlsLm6_w4GEgKBjzXBRwppu6qbtmAl6UjZ
  DlZeaWQlBsYhOu88-ekpNXpZ2iY96zTRI229zaJ5sw",
    "ApexDigest":"T7S1FcrgY3AaWD4L-t5W1K-3XYkPTcOdGEGyjglTD6yMYVR
  Vz9tn_KQc6GdA-P4VSRigBygV65OEd2Vv3YDhww"}}</sourcecode>
</section>
<section title="Signed sequence" anchor="n-signed-sequence-"><t>The following example shows a tree sequence with a signature in the final record. The signing key parameters are: </t>
<sourcecode>{
  "PrivateKeyECDH":{
    "Private":"TDuiCw36Z9tFE65-5wImmDqIZv8AsY6TBTkNQuxVxbU",
    "crv":"Ed25519"}}</sourcecode>
<t>The sequence headers and trailers are: </t>
<t>Frame 0 </t>
<sourcecode>{
  "DareHeader":{
    "policy":{},
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "DataEncoding":"JSON",
      "ContainerType":"Merkle",
      "Index":0},
    "dig":"S512"}}

[Empty trailer]</sourcecode>
<t>Frame 0 </t>
<sourcecode>{
  "DareHeader":{
    "policy":{},
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "DataEncoding":"JSON",
      "ContainerType":"Merkle",
      "Index":0},
    "dig":"S512"}}

{
  "DareTrailer":{
    "PayloadDigest":"z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg_SpIdNs6c5H
  0NE8XYXysP-DGNKHfuwvY7kxvUdBeoGlODJ6-SfaPg",
    "ApexDigest":"wvk8X5vTHUlVff7cj3k6fHBqXw52PA_7KK5zRLkheMKnGVF
  gHY0VL46Fz78rIjCnSNGXmDoBBG5phZRCU1guDA"}}</sourcecode>
<t>Frame 1 </t>
<sourcecode>{
  "DareHeader":{
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "Index":1,
      "TreePosition":0},
    "dig":"S512"}}

{
  "DareTrailer":{
    "PayloadDigest":"8dyi62d7MDJlsLm6_w4GEgKBjzXBRwppu6qbtmAl6UjZ
  DlZeaWQlBsYhOu88-ekpNXpZ2iY96zTRI229zaJ5sw",
    "ApexDigest":"vJ6ngNATvZcXSMALi5IUqzl1GBxBnTNVcC87VL_BhMRCbAv
  KSj8gs0VFgxxLkZ2myrtaDIwhHoswiTiBMLNWug"}}</sourcecode>
<t>Frame 2 </t>
<sourcecode>{
  "DareHeader":{
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "Index":2,
      "TreePosition":392},
    "dig":"S512"}}

{
  "DareTrailer":{
    "PayloadDigest":"8dyi62d7MDJlsLm6_w4GEgKBjzXBRwppu6qbtmAl6UjZ
  DlZeaWQlBsYhOu88-ekpNXpZ2iY96zTRI229zaJ5sw",
    "ApexDigest":"T7S1FcrgY3AaWD4L-t5W1K-3XYkPTcOdGEGyjglTD6yMYVR
  Vz9tn_KQc6GdA-P4VSRigBygV65OEd2Vv3YDhww"}}</sourcecode>
</section>
<section title="Encrypted sequence" anchor="n-encrypted-sequence-"><t>The following example shows a sequence in which all the frame payloads are encrypted  under the same base seed established in a key agreement specified in the first frame. </t>
<t>Frame 0 </t>
<sourcecode>{
  "DareHeader":{
    "enc":"A256CBC",
    "kid":"EBQN-IVZM-RV6Z-LKHQ-RBTD-IKC3-5FLO",
    "Salt":"TEi5zWuhHITF7cp_7sVaFQ",
    "recipients":[{
        "kid":"MC3P-SEXC-G5NY-LUUQ-CDZU-JZTN-HMPX",
        "epk":{
          "PublicKeyECDH":{
            "crv":"Ed25519",
            "Public":"D4LGUaecvORy0cd4vsECx6fIJ9DhoH42DY9Yu0Q-mco"}},
        "wmk":"t--P2gKKcdG44ykzS-ebnu8qow4RzHMvfvdw_DZyCPh2Ocxhv9
  UYGg"}
      ],
    "policy":{
      "enc":"none",
      "dig":"none",
      "EncryptKeys":[{
          "PublicKeyECDH":{
            "crv":"Ed25519",
            "Public":"YGeU8eFXt5yrx9dLZcMMxMILtFXVyJYm4N_EgQpLny0"}}
        ],
      "Sealed":true},
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "DataEncoding":"JSON",
      "ContainerType":"List",
      "Index":0}}}

[Empty trailer]</sourcecode>
<t>Frame 0 </t>
<sourcecode>{
  "DareHeader":{
    "enc":"A256CBC",
    "kid":"EBQN-IVZM-RV6Z-LKHQ-RBTD-IKC3-5FLO",
    "Salt":"TEi5zWuhHITF7cp_7sVaFQ",
    "recipients":[{
        "kid":"MC3P-SEXC-G5NY-LUUQ-CDZU-JZTN-HMPX",
        "epk":{
          "PublicKeyECDH":{
            "crv":"Ed25519",
            "Public":"D4LGUaecvORy0cd4vsECx6fIJ9DhoH42DY9Yu0Q-mco"}},
        "wmk":"t--P2gKKcdG44ykzS-ebnu8qow4RzHMvfvdw_DZyCPh2Ocxhv9
  UYGg"}
      ],
    "policy":{
      "enc":"none",
      "dig":"none",
      "EncryptKeys":[{
          "PublicKeyECDH":{
            "crv":"Ed25519",
            "Public":"YGeU8eFXt5yrx9dLZcMMxMILtFXVyJYm4N_EgQpLny0"}}
        ],
      "Sealed":true},
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "DataEncoding":"JSON",
      "ContainerType":"List",
      "Index":0}}}

[Empty trailer]</sourcecode>
<t>Frame 1 </t>
<sourcecode>{
  "DareHeader":{
    "enc":"A256CBC",
    "kid":"EBQO-E5M7-AX3M-64RV-URBD-YLK4-55ZI",
    "Salt":"h4wYVQ-B7-wjyQXpq0is6w",
    "recipients":[{
        "kid":"MC3P-SEXC-G5NY-LUUQ-CDZU-JZTN-HMPX",
        "epk":{
          "PublicKeyECDH":{
            "crv":"Ed25519",
            "Public":"7slT2nwWlG02PcNUKhiuLl4Qv6pl_8tepx0VvLLVyd8"}},
        "wmk":"RO3vfpIHVEue0NKWlug8qMehNy5ZbW0l8dkcx01RODrtfhtrT6
  Qg_A"}
      ],
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "Index":1}}}

[Empty trailer]</sourcecode>
<t>Frame 2 </t>
<sourcecode>{
  "DareHeader":{
    "enc":"A256CBC",
    "kid":"EBQF-PHKL-XPKR-5XOX-VY5P-IEHR-2JX3",
    "Salt":"AIMOhxvfwJN84v-FoOg8tg",
    "recipients":[{
        "kid":"MC3P-SEXC-G5NY-LUUQ-CDZU-JZTN-HMPX",
        "epk":{
          "PublicKeyECDH":{
            "crv":"Ed25519",
            "Public":"rO7GBQdRNtMulPp5URjRDonOvyAErZ0RZanPNJgAA1s"}},
        "wmk":"viwFWZiJ8WzzEfYKls_G3_t4ipnf-47Kgw1bIqZtH3QZzdfVrV
  H4GQ"}
      ],
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "Index":2}}}

[Empty trailer]</sourcecode>
<t>Here are the sequence bytes. Note that the content is now encrypted and has expanded by 25 bytes. These are the salt (16 bytes), the AES padding (4 bytes) and the  JSON-B framing (5 bytes). </t>
<t>The following example shows a sequence in which all the frame payloads are encrypted  under separate key agreements specified in the payload frames. </t>
<t>Frame 0 </t>
<sourcecode>{
  "DareHeader":{
    "policy":{
      "enc":"none",
      "dig":"none",
      "Sealed":true},
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "DataEncoding":"JSON",
      "ContainerType":"List",
      "Index":0}}}

[Empty trailer]</sourcecode>
<t>Frame 0 </t>
<sourcecode>{
  "DareHeader":{
    "policy":{
      "enc":"none",
      "dig":"none",
      "Sealed":true},
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "DataEncoding":"JSON",
      "ContainerType":"List",
      "Index":0}}}

[Empty trailer]</sourcecode>
<t>Frame 1 </t>
<sourcecode>{
  "DareHeader":{
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "Index":1}}}

[Empty trailer]</sourcecode>
<t>Frame 2 </t>
<sourcecode>{
  "DareHeader":{
    "ContentMetaData":"e30",
    "SequenceInfo":{
      "Index":2}}}

[Empty trailer]</sourcecode>
</section>
</section>
<section title="Appendix C: Previous Frame Function" anchor="n-appendix-c-previous-frame-function-"><sourcecode>public long PreviousFrame (long Frame) {
    long x2 = Frame + 1;
    long d = 1;

    while (x2 &gt; 0) {
        if ((x2 &amp; 1) == 1) {
            return x2 == 1 ? (d / 2) - 1 : Frame - d;
            }
        d = d * 2;
        x2 = x2 / 2;
        }
    return 0;
    }</sourcecode>
</section>
<section title="Appendix D: Outstanding Issues" anchor="n-appendix-d-outstanding-issues"><t>The following issues need to be addressed.</t>
<table><thead>
<tr>
<th>
Issue</th>
<th>
Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Signature</td>
<td>
No examples are given of signing a container. Need individual, chain, tree. Leave notarized for notary draft.</td>
</tr>
<tr>
<td>
Indexing</td>
<td>
No examples are given of indexing a container</td>
</tr>
<tr>
<td>
Archive</td>
<td>
Should include a file archive example</td>
</tr>
<tr>
<td>
File Path</td>
<td>
Mention the file path security issue in the security considerations</td>
</tr>
<tr>
<td>
Security Considerations</td>
<td>
Write Security considerations</td>
</tr>
<tr>
<td>
AES-GCM</td>
<td>
Switch to using AES GCM in the examples </td>
</tr>
<tr>
<td>
KMAC</td>
<td>
Switch to using KMAC for KDF</td>
</tr>
<tr>
<td>
Witness</td>
<td>
Complete handling of witness values.</td>
</tr>
<tr>
<td>
Schema</td>
<td>
Complete the schema documentation</td>
</tr>
</tbody>
</table><t></t>
</section>
</middle>
<back>
<references title="Normative References"><reference anchor="RFC7515"><front>
<title>JSON Web Signature (JWS)</title>
<author fullname="M. Jones" initials="M." surname="Jones"><address>
</address>
</author>
<author fullname="J. Bradley" initials="J." surname="Bradley"><address>
</address>
</author>
<author fullname="N. Sakimura" initials="N." surname="Sakimura"><address>
</address>
</author>
<date month="May" year="2015"/>
</front>
<seriesInfo name="RFC" value="7515"/>
<seriesInfo name="DOI" value="10.17487/RFC7515"/>
</reference>
<reference anchor="draft-hallambaker-mesh-security"><front>
<title>Mathematical Mesh 3.0 Part IX Security Considerations</title>
<author fullname="Phillip Hallam-Baker" initials="P." surname="Hallam-Baker"><organization>ThresholdSecrets.com</organization>
<address>
</address>
</author>
<date day="20" month="April" year="2022"/>
</front>
<seriesInfo name="Internet-Draft" value="draft-hallambaker-mesh-security-09"/>
</reference>
<reference anchor="draft-hallambaker-mesh-udf"><front>
<title>Mathematical Mesh 3.0 Part II: Uniform Data Fingerprint.</title>
<author fullname="Phillip Hallam-Baker" initials="P." surname="Hallam-Baker"><organization>ThresholdSecrets.com</organization>
<address>
</address>
</author>
<date day="28" month="June" year="2023"/>
</front>
<seriesInfo name="Internet-Draft" value="draft-hallambaker-mesh-udf-18"/>
</reference>
<reference anchor="draft-hallambaker-jsonbcd"><front>
<title>Binary Encodings for JavaScript Object Notation: JSON-B, JSON-C, JSON-D</title>
<author fullname="Phillip Hallam-Baker" initials="P." surname="Hallam-Baker"><address>
</address>
</author>
<date day="28" month="June" year="2023"/>
</front>
<seriesInfo name="Internet-Draft" value="draft-hallambaker-jsonbcd-24"/>
</reference>
<reference anchor="RFC6838"><front>
<title>Media Type Specifications and Registration Procedures</title>
<author fullname="N. Freed" initials="N." surname="Freed"><address>
</address>
</author>
<author fullname="J. Klensin" initials="J." surname="Klensin"><address>
</address>
</author>
<author fullname="T. Hansen" initials="T." surname="Hansen"><address>
</address>
</author>
<date month="January" year="2013"/>
</front>
<seriesInfo name="BCP" value="13"/>
<seriesInfo name="RFC" value="6838"/>
<seriesInfo name="DOI" value="10.17487/RFC6838"/>
</reference>
<reference anchor="RFC4949"><front>
<title>Internet Security Glossary, Version 2</title>
<author fullname="R. Shirey" initials="R." surname="Shirey"><address>
</address>
</author>
<date month="August" year="2007"/>
</front>
<seriesInfo name="FYI" value="36"/>
<seriesInfo name="RFC" value="4949"/>
<seriesInfo name="DOI" value="10.17487/RFC4949"/>
</reference>
<reference anchor="RFC7518"><front>
<title>JSON Web Algorithms (JWA)</title>
<author fullname="M. Jones" initials="M." surname="Jones"><address>
</address>
</author>
<date month="May" year="2015"/>
</front>
<seriesInfo name="RFC" value="7518"/>
<seriesInfo name="DOI" value="10.17487/RFC7518"/>
</reference>
<reference anchor="draft-hallambaker-mesh-architecture"><front>
<title>Mathematical Mesh 3.0 Part I: Architecture Guide</title>
<author fullname="Phillip Hallam-Baker" initials="P." surname="Hallam-Baker"><organization>ThresholdSecrets.com</organization>
<address>
</address>
</author>
<date day="28" month="June" year="2023"/>
</front>
<seriesInfo name="Internet-Draft" value="draft-hallambaker-mesh-architecture-22"/>
</reference>
<reference anchor="RFC3394"><front>
<title>Advanced Encryption Standard (AES) Key Wrap Algorithm</title>
<author fullname="J. Schaad" initials="J." surname="Schaad"><address>
</address>
</author>
<author fullname="R. Housley" initials="R." surname="Housley"><address>
</address>
</author>
<date month="September" year="2002"/>
</front>
<seriesInfo name="RFC" value="3394"/>
<seriesInfo name="DOI" value="10.17487/RFC3394"/>
</reference>
<reference anchor="RFC2315"><front>
<title>PKCS #7: Cryptographic Message Syntax Version 1.5</title>
<author fullname="B. Kaliski" initials="B." surname="Kaliski"><address>
</address>
</author>
<date month="March" year="1998"/>
</front>
<seriesInfo name="RFC" value="2315"/>
<seriesInfo name="DOI" value="10.17487/RFC2315"/>
</reference>
<reference anchor="RFC2119"><front>
<title>Key words for use in RFCs to Indicate Requirement Levels</title>
<author fullname="S. Bradner" initials="S." surname="Bradner"><address>
</address>
</author>
<date month="March" year="1997"/>
</front>
<seriesInfo name="BCP" value="14"/>
<seriesInfo name="RFC" value="2119"/>
<seriesInfo name="DOI" value="10.17487/RFC2119"/>
</reference>
<reference anchor="RFC7159"><front>
<title>The JavaScript Object Notation (JSON) Data Interchange Format</title>
<author fullname="T. Bray" initials="T." surname="Bray"><address>
</address>
</author>
<date month="March" year="2014"/>
</front>
<seriesInfo name="RFC" value="7159"/>
<seriesInfo name="DOI" value="10.17487/RFC7159"/>
</reference>
<reference anchor="RFC5869"><front>
<title>HMAC-based Extract-and-Expand Key Derivation Function (HKDF)</title>
<author fullname="H. Krawczyk" initials="H." surname="Krawczyk"><address>
</address>
</author>
<author fullname="P. Eronen" initials="P." surname="Eronen"><address>
</address>
</author>
<date month="May" year="2010"/>
</front>
<seriesInfo name="RFC" value="5869"/>
<seriesInfo name="DOI" value="10.17487/RFC5869"/>
</reference>
<reference anchor="RFC4880"><front>
<title>OpenPGP Message Format</title>
<author fullname="J. Callas" initials="J." surname="Callas"><address>
</address>
</author>
<author fullname="L. Donnerhacke" initials="L." surname="Donnerhacke"><address>
</address>
</author>
<author fullname="H. Finney" initials="H." surname="Finney"><address>
</address>
</author>
<author fullname="D. Shaw" initials="D." surname="Shaw"><address>
</address>
</author>
<author fullname="R. Thayer" initials="R." surname="Thayer"><address>
</address>
</author>
<date month="November" year="2007"/>
</front>
<seriesInfo name="RFC" value="4880"/>
<seriesInfo name="DOI" value="10.17487/RFC4880"/>
</reference>
<reference anchor="RFC7516"><front>
<title>JSON Web Encryption (JWE)</title>
<author fullname="M. Jones" initials="M." surname="Jones"><address>
</address>
</author>
<author fullname="J. Hildebrand" initials="J." surname="Hildebrand"><address>
</address>
</author>
<date month="May" year="2015"/>
</front>
<seriesInfo name="RFC" value="7516"/>
<seriesInfo name="DOI" value="10.17487/RFC7516"/>
</reference>
<reference anchor="RFC7517"><front>
<title>JSON Web Key (JWK)</title>
<author fullname="M. Jones" initials="M." surname="Jones"><address>
</address>
</author>
<date month="May" year="2015"/>
</front>
<seriesInfo name="RFC" value="7517"/>
<seriesInfo name="DOI" value="10.17487/RFC7517"/>
</reference>
<reference anchor="IANAJOSE"><front>
<title>[Reference Not Found!]</title>
<author initials="" surname=""><organization/>
<address>
</address>
</author>
<date/>
</front>
</reference>
</references>
<references title="Informative References"><reference anchor="Davis2001"><front>
<title>Defective Sign &amp; Encrypt in S/MIME, PKCS#7, MOSS, PEM, PGP, and XML</title>
<author fullname="Don Davis" initials="D." surname="Davis"><organization/>
<address>
</address>
</author>
<date month="May" year="2001"/>
</front>
</reference>
<reference anchor="ZIPFILE"><front>
<title>APPNOTE.TXT - .ZIP File Format Specification</title>
<author><organization>PKWARE Inc</organization>
<address>
</address>
</author>
<date month="October" year="2014"/>
</front>
<format type="txt" target="https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT"/>
</reference>
<reference anchor="BLOCKCHAIN"><front>
<title>Blockchain Specification</title>
<author><organization>Chain.com</organization>
<address>
</address>
</author>
<date/>
</front>
<format type="html" target="https://chain.com/docs/1.2/protocol/specifications/blockchain"/>
</reference>
<reference anchor="RFC5652"><front>
<title>Cryptographic Message Syntax (CMS)</title>
<author fullname="R. Housley" initials="R." surname="Housley"><address>
</address>
</author>
<date month="September" year="2009"/>
</front>
<seriesInfo name="STD" value="70"/>
<seriesInfo name="RFC" value="5652"/>
<seriesInfo name="DOI" value="10.17487/RFC5652"/>
</reference>
</references>
</back>
</rfc>
