<?xml version="1.0" encoding="UTF-8"?>
  <?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
  <!-- generated by https://github.com/cabo/kramdown-rfc2629 version 1.2.9 -->

<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
]>

<?rfc toc="yes"?>
<?rfc tocindent="yes"?>
<?rfc sortrefs="yes"?>
<?rfc symrefs="yes"?>
<?rfc strict="yes"?>
<?rfc compact="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc docmapping="yes"?>

<rfc ipr="trust200902" docName="draft-thomson-http-mice-03" category="std">

  <front>
    <title abbrev="MICE">Merkle Integrity Content Encoding</title>

    <author initials="M." surname="Thomson" fullname="Martin Thomson">
      <organization>Mozilla</organization>
      <address>
        <email>martin.thomson@gmail.com</email>
      </address>
    </author>
    <author initials="J." surname="Yasskin" fullname="Jeffrey Yasskin">
      <organization>Google</organization>
      <address>
        <email>jyasskin@chromium.org</email>
      </address>
    </author>

    <date year="2018" month="August" day="14"/>

    <area>General</area>
    
    <keyword>Internet-Draft</keyword>

    <abstract>


<t>This memo introduces a content-coding for HTTP that provides progressive
integrity for message contents.  This integrity protection can be evaluated on a
partial representation, allowing a recipient to process a message as it is
delivered while retaining strong integrity protection.</t>



    </abstract>


    <note title="Note to Readers">


<t><spanx style="emph">RFC EDITOR: please remove this section before publication</spanx></t>

<t>Discussion of this draft takes place on the HTTP working group mailing list
(ietf-http-wg@w3.org), which is archived at
<eref target="https://lists.w3.org/Archives/Public/ietf-http-wg/">https://lists.w3.org/Archives/Public/ietf-http-wg/</eref>.</t>

<t>The source code and issues list for this draft can be found at
<eref target="https://github.com/martinthomson/http-mice">https://github.com/martinthomson/http-mice</eref>.</t>


    </note>


  </front>

  <middle>


<section anchor="introduction" title="Introduction">

<t>Integrity protection for HTTP content is highly valuable.  HTTPS <xref target="RFC2818"></xref> is
the most common form of integrity protection deployed, but that requires a
direct TLS <xref target="RFC8446"/> connection to a host.  However, additional integrity
protection might be desirable for some use cases.  This might be for additional
protection against failures or attack (see <xref target="SRI"></xref>) or because content needs to
remain unmodified throughout multiple HTTPS-protected exchanges.</t>

<t>This document describes a “mi-sha256” content-encoding (see <xref target="encoding"/>) that
is a progressive, hash-based integrity check based on Merkle Hash Trees
<xref target="MERKLE"></xref>.</t>

<t>The means of conveying the root integrity proof used by this content encoding
will depend on deployment requirements.  This document defines a digest
algorithm (see <xref target="digest-mi-sha256"/>) that can carry an integrity proof.</t>

<section anchor="notational-conventions" title="Notational Conventions">

<t>The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”,
“SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be
interpreted as described in <xref target="RFC2119"></xref>.</t>

</section>
</section>
<section anchor="encoding" title="The “mi-sha256” HTTP Content Encoding">

<t>A Merkle Hash Tree <xref target="MERKLE"></xref> is a structured integrity mechanism that collates
multiple integrity checks into a tree.  The leaf nodes of the tree contain data
(or hashes of data) and non-leaf nodes contain hashes of the nodes below them.</t>

<t>A balanced Merkle Hash Tree is used to efficiently prove membership in large
sets (such as in <xref target="RFC6962"></xref>).  However, in this case, a right-skewed tree is used
to provide a progressive integrity proof.  This integrity proof is used to
establish that a given record is part of a message.</t>

<t>The hash function used for “mi-sha256” content encoding is SHA-256 <xref target="FIPS180-4"></xref>.
The integrity proof for all records other than the last is the hash of the
concatenation of the record, the integrity proof of all subsequent records, and
a single octet with a value of 0x1:</t>

<figure><artwork><![CDATA[
   proof(r[i]) = SHA-256(r[i] || proof(r[i+1]) || 0x1)
]]></artwork></figure>

<t>The integrity proof for the final record is the hash of the record with a single
octet with a value 0x0 appended:</t>

<figure><artwork><![CDATA[
   proof(r[last]) = SHA-256(r[last] || 0x0)
]]></artwork></figure>

<t><xref target="ex-proofs"/> shows the structure of the integrity proofs for a message that is
split into 4 blocks: A, B, C, D).  As shown, the integrity proof for the entire
message (that is, <spanx style="verb">proof(A)</spanx>) is derived from the content of the first block
(A), plus the value of the proof for the second and subsequent blocks.</t>

<figure title="Proof structure for a message with 4 blocks" anchor="ex-proofs"><artwork><![CDATA[
    proof(A)
      /\
     /  \
    /    \
   A    proof(B)
         /\
        /  \
       /    \
      B    proof(C)
             /\
            /  \
           /    \
          C    proof(D)
                 |
                 |
                 D
]]></artwork></figure>

<t>The final encoded message is formed from the record size and first record,
followed by an arbitrary number of tuples of the integrity proof of the next
record and then the record itself.  Thus, in <xref target="ex-proofs"/>, the body is:</t>

<figure><artwork><![CDATA[
   rs || A || proof(B) || B || proof(C) || C || proof(D) || D
]]></artwork></figure>

<t><list style="hanging">
  <t hangText='Note:'>
  The <spanx style="verb">||</spanx> operator is used to represent concatenation.</t>
</list></t>

<t>A message that has a content length less than or equal to the content size does
not include any inline proofs.  The proof for a message with a single record is
simply the hash of the body plus a trailing zero octet.</t>

<t>As a special case, the encoding of an empty payload is itself an empty message
(i.e. it omits the initial record size), and its integrity proof is
SHA-256(“\0”).</t>

<t><spanx style="emph">RFC EDITOR: Please remove the next paragraph before publication.</spanx></t>

<t>Implementations of drafts of this specification MUST implement a content
encoding named “mi-sha256-##” instead of the “mi-sha256” content encoding
specified by the final RFC, with “##” replaced by the draft number being
implemented. For example, implementations of draft-thomson-http-mice-03 would
implement “mi-sha256-03”.</t>

<section anchor="records" title="Content Encoding Structure">

<t>In order to produce the final content encoding the content of the message is
split into equal-sized records.  The final record can contain less than the
defined record size.</t>

<t>For non-empty payloads, the record size is included in the first 8 octets of the
message as an unsigned 64-bit integer.  This refers to the length of each data
block.</t>

<t>The final encoded stream comprises of the record size (“rs”), plus a sequence of
records, each “rs” octets in length.  Each record, other than the last, is
followed by a 32 octet proof for the record that follows.  This allows a
receiver to validate and act upon each record after receiving the proof that
precedes it.  The final record is not followed by a proof.</t>

<t><list style="hanging">
  <t hangText='Note:'>
  This content encoding increases the size of a message by 8 plus 32 octets
times the length of the message divided by the record size, rounded up, less
one.  That is, 8 + 32 * (ceil(length / rs) - 1).</t>
</list></t>

<t>Constructing a message with the “mi-sha256” content encoding requires processing
of the records in reverse order, inserting the proof derived from each record
before that record.</t>

<t>This structure permits the use of range requests <xref target="RFC7233"></xref>. However, to validate
a given record, a contiguous sequence of records back to the start of the
message is needed.</t>

</section>
<section anchor="validating" title="Validating Integrity Proofs">

<t>A receiver of a message with the “mi-sha256” content-encoding applied first
attempts to acquire the integrity proof for the first record, <spanx style="verb">top-proof</spanx>.  If
the Digest header field is present with the mi-sha256 parameter, a value might
be included there.</t>

<t>The receiver attempts to read the first 8 octets as an unsigned 64-bit integer,
“rs”. If 8 octets aren’t available then:</t>

<t><list style="symbols">
  <t>If 0 octets are available, and <spanx style="verb">top-proof</spanx> is SHA-256(“\0”) (whose base64
encoding is “bjQLnP+zepicpUTmu3gKLHiQHT+zNzh2hRGjBhevoB0=”), then return a
0-length decoded payload.</t>
  <t>Otherwise, validation fails.</t>
</list></t>

<t>The remainder of the message is read into records of size “rs” plus 32 octets.
The last record is between 1 and “rs” octets in length, if not then validation
fails.  For each record:</t>

<t><list style="numbers">
  <t>Hash the record using SHA-256 with a single octet appended:  <vspace blankLines='1'/>
a. All records other than the last have an octet with a value of 0x1
   appended.  <vspace blankLines='1'/>
b. The last record has an octet with a value of 0x0 appended.</t>
  <t>Compare the hash with the expected value:  <vspace blankLines='1'/>
a. For the first record, the expected value is <spanx style="verb">top-proof</spanx>.  <vspace blankLines='1'/>
b. For records after the first, the expected value is the last 32 octets of
   the previous record.</t>
  <t>If the hash is different, then this record and all subsequent records do not
have integrity protection and this process ends.</t>
  <t>If a record is valid, up to “rs” octets is passed on for processing.  In
other words, the trailing 32 octets is removed from every record other than
the last before being used.</t>
</list></t>

<t>If an integrity check fails, the message SHOULD be discarded and the exchange
treated as an error unless explicitly configured otherwise.  For clients, treat
this as equivalent to a server error; servers SHOULD generate a 400 or other 4xx
status code.  However, if the integrity proof for the first record is not known,
this check SHOULD NOT fail unless explicitly configured to do so.</t>

</section>
</section>
<section anchor="digest-mi-sha256" title="The “mi-sha256” Digest Algorithm">

<t><xref target="RFC3230"/> describes digests applying to “the entire instance associated with
the message”. The instance corresponds to the “representation” in Section 3 of
<xref target="RFC7231"></xref>, but unlike the existing digest algorithms, the “mi-sha256” digest
algorithm specifies the top-level digest at the point when the “mi-sha256”
content coding (<xref target="encoding"/>) is applied or removed from the representation.</t>

<t>When the “mi-sha256” digest algorithm is specified for a representation, the
recipient MUST use the base64-decoding (Section 4 of <xref target="RFC4648"/>) of the
“mi-sha256” digest as the <spanx style="verb">top-proof</spanx> for the “mi-sha256” content encoding
(<xref target="validating"/>).</t>

<t>The recipient MUST behave as described by Section 4.2.9 of
<xref target="I-D.ietf-httpbis-header-structure"/> if it encounters improper padding,
non-zero padding bits, or non-alphabet characters, where rejecting the data
means to reject the representation.</t>

<t>If different mechanisms specify different <spanx style="verb">top-proof</spanx> values for the “mi-sha256”
content encoding, the recipient MUST reject the representation.</t>

<t>If “mi-sha256” content coding has not been applied to the representation exactly
once (Section 3.1.2.2 of <xref target="RFC7231"></xref>), the recipient MUST reject the
representation.</t>

<t>When rejecting the representation, clients SHOULD treat this as equivalent
to a server error, and servers SHOULD generate a 400 or other 4xx status code.</t>

<t><spanx style="emph">RFC EDITOR: Please remove the next paragraph before publication.</spanx></t>

<t>Implementations of drafts of this specification MUST use a digest algorithm
named the same as the “mi-sha256-##” content encoding they implement, with the
meaning described for “mi-sha256” above.</t>

</section>
<section anchor="examples" title="Examples">

<section anchor="simple-example" title="Simple Example">

<t>The following example contains a short message.  This contains just a single
record, so there are no inline integrity proofs, just a single value in the
mi-sha256 parameter of a Digest header field.  The record size is prepended to
the message body (shown here in angle brackets).</t>

<figure><artwork><![CDATA[
HTTP/1.1 200 OK
Digest: mi-sha256=dcRDgR2GM35DluAV13PzgnG6+pvQwPywfFvAu1UeFrs=
Content-Encoding: mi-sha256
Content-Length: 49

<0x0000000000000029>When I grow up, I want to be a watermelon
]]></artwork></figure>

</section>
<section anchor="example-with-multiple-records" title="Example with Multiple Records">

<t>This example shows the same message as above, but with a smaller record size (16
octets).  This results in two integrity proofs being included in the
representation.</t>

<figure><artwork><![CDATA[
PUT /test HTTP/1.1
Host: example.com
Digest: mi-sha256=IVa9shfs0nyKEhHqtB3WVNANJ2Njm5KjQLjRtnbkYJ4=
Content-Encoding: mi-sha256
Content-Length: 113

<0x0000000000000010>When I grow up,
OElbplJlPK+Rv6JNK6p5/515IaoPoZo+2elWL7OQ60A=
I want to be a w
iPMpmgExHPrbEX3/RvwP4d16fWlK4l++p75PUu_KyN0=
atermelon
]]></artwork></figure>

<t>Since the inline integrity proofs contain non-printing characters, these are
shown here using the base64 encoding <xref target="RFC4648"/> with new lines between the
original text and integrity proofs.  Note that there is a single trailing space
(0x20) on the first line.</t>

</section>
</section>
<section anchor="security-considerations" title="Security Considerations">

<t>The integrity of an entire message body depends on the means by which the
integrity proof for the first record is protected.  If this value comes from the
same place as the message, then this provides only limited protection against
transport-level errors (something that TLS provides adequate protection
against).</t>

<t>Separate protection for header fields might be provided by other means if the
first record retrieved is the first record in the message, but range requests do
not allow for this option.</t>

<section anchor="message-truncation" title="Message Truncation">

<t>This integrity scheme permits the detection of truncated messages.  However, it
enables and even encourages processing of messages prior to receiving an
complete message.  Actions taken on a partial message can produce incorrect
results.  For example, a message could say “I need some 2mm copper cable, please
send 100mm for evaluation purposes” then be truncated to “I need some 2mm copper
cable, please send 100m”.  A network-based attacker might be able to force this
sort of truncation by delaying packets that contain the remainder of the
message.</t>

<t>Whether it is safe to act on partial messages will depend on the nature of the
message and the processing that is performed.</t>

</section>
<section anchor="algorithm-agility" title="Algorithm Agility">

<t>A new content encoding type is needed in order to define the use of a hash
function other than SHA-256.</t>

</section>
</section>
<section anchor="iana-considerations" title="IANA Considerations">

<section anchor="the-mi-sha256-http-content-encoding" title="The “mi-sha256” HTTP Content Encoding">

<t>This memo registers the “mi-sha256” HTTP content-coding in the HTTP Content Codings
Registry, as detailed in <xref target="encoding"/>.</t>

<t><list style="symbols">
  <t>Name: mi-sha256</t>
  <t>Description: A Merkle Hash Tree based content encoding that provides
             progressive integrity.</t>
  <t>Reference: this specification</t>
</list></t>

</section>
<section anchor="iana-digest" title="The “mi-sha256” Digest Algorithm">

<t>This memo registers the “mi-sha256” digest algorithm in the <eref target="https://www.iana.org/assignments/http-dig-alg/http-dig-alg.xhtml">HTTP Digest
Algorithm
Values</eref>
registry:</t>

<t><list style="symbols">
  <t>Digest Algorithm: mi-sha256</t>
  <t>Description: As specified in <xref target="digest-mi-sha256"/>.</t>
</list></t>

</section>
</section>


  </middle>

  <back>

    <references title='Normative References'>





<reference  anchor="RFC2119" target='https://www.rfc-editor.org/info/rfc2119'>
<front>
<title>Key words for use in RFCs to Indicate Requirement Levels</title>
<author initials='S.' surname='Bradner' fullname='S. Bradner'><organization /></author>
<date year='1997' month='March' />
<abstract><t>In many standards track documents several words are used to signify the requirements in the specification.  These words are often capitalized. This document defines these words as they should be interpreted in IETF documents.  This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t></abstract>
</front>
<seriesInfo name='BCP' value='14'/>
<seriesInfo name='RFC' value='2119'/>
<seriesInfo name='DOI' value='10.17487/RFC2119'/>
</reference>



<reference  anchor="RFC7231" target='https://www.rfc-editor.org/info/rfc7231'>
<front>
<title>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</title>
<author initials='R.' surname='Fielding' fullname='R. Fielding' role='editor'><organization /></author>
<author initials='J.' surname='Reschke' fullname='J. Reschke' role='editor'><organization /></author>
<date year='2014' month='June' />
<abstract><t>The Hypertext Transfer Protocol (HTTP) is a stateless \%application- level protocol for distributed, collaborative, hypertext information systems.  This document defines the semantics of HTTP/1.1 messages, as expressed by request methods, request header fields, response status codes, and response header fields, along with the payload of messages (metadata and body content) and mechanisms for content negotiation.</t></abstract>
</front>
<seriesInfo name='RFC' value='7231'/>
<seriesInfo name='DOI' value='10.17487/RFC7231'/>
</reference>


<reference anchor="FIPS180-4" target="http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf">
  <front>
    <title>NIST FIPS 180-4, Secure Hash Standard</title>
    <author initials="National Institute of Standards and Technology, U.S." surname="Department of Commerce" fullname="NIST">
      <organization></organization>
    </author>
    <date year="2012" month="March"/>
  </front>
</reference>
<reference anchor="MERKLE" >
  <front>
    <title>A Digital Signature Based on a Conventional Encryption Function</title>
    <author initials="R." surname="Merkle">
      <organization></organization>
    </author>
    <date year="1987"/>
  </front>
  <seriesInfo name="International Crytology Conference - CRYPTO" value=""/>
</reference>




<reference  anchor="RFC3230" target='https://www.rfc-editor.org/info/rfc3230'>
<front>
<title>Instance Digests in HTTP</title>
<author initials='J.' surname='Mogul' fullname='J. Mogul'><organization /></author>
<author initials='A.' surname='Van Hoff' fullname='A. Van Hoff'><organization /></author>
<date year='2002' month='January' />
<abstract><t>HTTP/1.1 defines a Content-MD5 header that allows a server to include a digest of the response body.  However, this is specifically defined to cover the body of the actual message, not the contents of the full file (which might be quite different, if the response is a Content-Range, or uses a delta encoding).  Also, the Content-MD5 is limited to one specific digest algorithm; other algorithms, such as SHA-1 (Secure Hash Standard), may be more appropriate in some circumstances.  Finally, HTTP/1.1 provides no explicit mechanism by which a client may request a digest.  This document proposes HTTP extensions that solve these problems.  [STANDARDS-TRACK]</t></abstract>
</front>
<seriesInfo name='RFC' value='3230'/>
<seriesInfo name='DOI' value='10.17487/RFC3230'/>
</reference>



<reference  anchor="RFC4648" target='https://www.rfc-editor.org/info/rfc4648'>
<front>
<title>The Base16, Base32, and Base64 Data Encodings</title>
<author initials='S.' surname='Josefsson' fullname='S. Josefsson'><organization /></author>
<date year='2006' month='October' />
<abstract><t>This document describes the commonly used base 64, base 32, and base 16 encoding schemes.  It also discusses the use of line-feeds in encoded data, use of padding in encoded data, use of non-alphabet characters in encoded data, use of different encoding alphabets, and canonical encodings.  [STANDARDS-TRACK]</t></abstract>
</front>
<seriesInfo name='RFC' value='4648'/>
<seriesInfo name='DOI' value='10.17487/RFC4648'/>
</reference>



<reference anchor="I-D.ietf-httpbis-header-structure">
<front>
<title>Structured Headers for HTTP</title>

<author initials='M' surname='Nottingham' fullname='Mark Nottingham'>
    <organization />
</author>

<author initials='P' surname='Kamp' fullname='Poul-Henning Kamp'>
    <organization />
</author>

<date month='July' day='2' year='2018' />

<abstract><t>This document describes a set of data types and algorithms associated with them that are intended to make it easier and safer to define and handle HTTP header fields.  It is intended for use by new specifications of HTTP header fields as well as revisions of existing header field specifications when doing so does not cause interoperability issues.</t></abstract>

</front>

<seriesInfo name='Internet-Draft' value='draft-ietf-httpbis-header-structure-07' />
<format type='TXT'
        target='http://www.ietf.org/internet-drafts/draft-ietf-httpbis-header-structure-07.txt' />
</reference>




    </references>

    <references title='Informative References'>





<reference  anchor="RFC2818" target='https://www.rfc-editor.org/info/rfc2818'>
<front>
<title>HTTP Over TLS</title>
<author initials='E.' surname='Rescorla' fullname='E. Rescorla'><organization /></author>
<date year='2000' month='May' />
<abstract><t>This memo describes how to use Transport Layer Security (TLS) to secure Hypertext Transfer Protocol (HTTP) connections over the Internet.  This memo provides information for the Internet community.</t></abstract>
</front>
<seriesInfo name='RFC' value='2818'/>
<seriesInfo name='DOI' value='10.17487/RFC2818'/>
</reference>



<reference  anchor="RFC6962" target='https://www.rfc-editor.org/info/rfc6962'>
<front>
<title>Certificate Transparency</title>
<author initials='B.' surname='Laurie' fullname='B. Laurie'><organization /></author>
<author initials='A.' surname='Langley' fullname='A. Langley'><organization /></author>
<author initials='E.' surname='Kasper' fullname='E. Kasper'><organization /></author>
<date year='2013' month='June' />
<abstract><t>This document describes an experimental protocol for publicly logging the existence of Transport Layer Security (TLS) certificates as they are issued or observed, in a manner that allows anyone to audit certificate authority (CA) activity and notice the issuance of suspect certificates as well as to audit the certificate logs themselves.  The intent is that eventually clients would refuse to honor certificates that do not appear in a log, effectively forcing CAs to add all issued certificates to the logs.</t><t>Logs are network services that implement the protocol operations for submissions and queries that are defined in this document.</t></abstract>
</front>
<seriesInfo name='RFC' value='6962'/>
<seriesInfo name='DOI' value='10.17487/RFC6962'/>
</reference>



<reference  anchor="RFC7233" target='https://www.rfc-editor.org/info/rfc7233'>
<front>
<title>Hypertext Transfer Protocol (HTTP/1.1): Range Requests</title>
<author initials='R.' surname='Fielding' fullname='R. Fielding' role='editor'><organization /></author>
<author initials='Y.' surname='Lafon' fullname='Y. Lafon' role='editor'><organization /></author>
<author initials='J.' surname='Reschke' fullname='J. Reschke' role='editor'><organization /></author>
<date year='2014' month='June' />
<abstract><t>The Hypertext Transfer Protocol (HTTP) is a stateless application- level protocol for distributed, collaborative, hypertext information systems.  This document defines range requests and the rules for constructing and combining responses to those requests.</t></abstract>
</front>
<seriesInfo name='RFC' value='7233'/>
<seriesInfo name='DOI' value='10.17487/RFC7233'/>
</reference>


<reference anchor="SRI" target="https://w3c.github.io/webappsec-subresource-integrity/">
  <front>
    <title>Subresource Integrity</title>
    <author initials="D." surname="Akhawe">
      <organization></organization>
    </author>
    <author initials="F." surname="Braun">
      <organization></organization>
    </author>
    <author initials="F." surname="Marier">
      <organization></organization>
    </author>
    <author initials="J." surname="Weinberger">
      <organization></organization>
    </author>
    <date year="2015" month="November" day="13"/>
  </front>
  <seriesInfo name="W3C CR" value=""/>
</reference>




<reference  anchor="RFC8446" target='https://www.rfc-editor.org/info/rfc8446'>
<front>
<title>The Transport Layer Security (TLS) Protocol Version 1.3</title>
<author initials='E.' surname='Rescorla' fullname='E. Rescorla'><organization /></author>
<date year='2018' month='August' />
<abstract><t>This document specifies version 1.3 of the Transport Layer Security (TLS) protocol.  TLS allows client/server applications to communicate over the Internet in a way that is designed to prevent eavesdropping, tampering, and message forgery.</t><t>This document updates RFCs 5705 and 6066, and obsoletes RFCs 5077, 5246, and 6961.  This document also specifies new requirements for TLS 1.2 implementations.</t></abstract>
</front>
<seriesInfo name='RFC' value='8446'/>
<seriesInfo name='DOI' value='10.17487/RFC8446'/>
</reference>




    </references>


<section anchor="acknowledgements" title="Acknowledgements">

<t>David Benjamin and Erik Nygren both separately suggested that something like
this might be valuable.  James Manger and Eric Rescorla provided useful
feedback.</t>

</section>
<section anchor="faq" title="FAQ">

<t><list style="numbers">
  <t>Why not include the first proof in the encoding?  <vspace blankLines='1'/>
The requirements for the integrity proof for the first record require a great
deal more flexibility than this allows for.  Transferring the proof
separately is sometimes necessary.  Separating the value out allows for that
to happen more easily.</t>
  <t>Why do messages have to be processed in reverse to construct them?  <vspace blankLines='1'/>
The final integrity value, no matter how it is derived, has to depend on
every bit of the message.  That means that there are three choices: both
sender and receiver have to process the whole message, the sender has to work
backwards, or the receiver has to work backwards.  The current form is the
best option of the three.  The expectation is that this will be useful for
content that is generated once and sent multiple times, since the onerous
backwards processing requirement can be amortized.</t>
  <t>Why not just generate a table of hashes?  <vspace blankLines='1'/>
An alternative design includes a header that comprises hashes of every block
of the message.  The final proof is a hash of that table.  This has the
advantage that the table can be built in any order.  The disadvantage is that
a receiver needs to store the table while processing content, whereas a
chained hash can be processed with a single stored hash worth of state no
matter how many blocks are present.  The chained hash is also smaller by 32
octets.</t>
</list></t>

</section>


  </back>

<!-- ##markdown-source:
H4sIAKdDclsAA8VbW3cTuZZ+16/QhIdJGtuxk5CGzKHPMUlowiWEJDTTw2E1
cpVsi9StS1VxDE3/9tkXqUplu2nmabIWxKmLtO/723vL/X5fVKZK9JF8pcub
RMuzrNKz0lRLeZzDx6ySp1mUxyabCTWZlPoWnjw7PhVxHmUqhffiUk2rfjXP
U5tn/XlVFf3URLo/3BeRgrXycnkkbRULYYrySFZlbau94fDRcE+oUqsj+bPO
dKkSscjLm1mZ18WRuNFL+Cs+ImrKTFf9E9xFCFupLP5NJXkGOy+1FYU5ku+r
POpJ+M9kMRDckzYvq1JPLXxapu5DVZoIbkV5Wij3IYWH4ZbJEpPpngSOUlUU
wOkHIVQNHJVHQvaFhB+TWeB7IK+ZTbrG7L9SZWWyzo28nKnMfFaVyTN4IP9s
kkTRHZ0qkxzJlN4ZOJn9a4ZXB0BQZ7fnA/mrsvbGhLs919NpqZedO93tfs7z
WaLD3T4t+eF/RfMyT02dDuANIbK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