<?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.3.21 -->
<!DOCTYPE rfc SYSTEM "rfc2629-xhtml.ent">
<?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 xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-polli-id-digest-algorithms-01" category="std" obsoletes="" updates="" submissionType="IETF" xml:lang="en" tocInclude="true" sortRefs="true" symRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.5.0 -->
  <front>
    <title>The "id-" prefix for Digest Algorithms</title>
    <seriesInfo name="Internet-Draft" value="draft-polli-id-digest-algorithms-01"/>
    <author initials="R." surname="Polli" fullname="Roberto Polli">
      <organization>Digital Transformation Department, Italian Government</organization>
      <address>
        <postal>
          <country>Italy</country>
        </postal>
        <email>robipolli@gmail.com</email>
      </address>
    </author>
    <date year="2020" month="December" day="18"/>
    <area>General</area>
    <keyword>Internet-Draft</keyword>
    <abstract>
      <t>This document defines
the "id-" prefix for digest-algorithms
used in the Digest HTTP field.
This prefix explicits that the value of the digest-algorithm
is independent from Content-Encoding.</t>
    </abstract>
    <note>
      <name>Note to Readers</name>
      <t><em>RFC EDITOR: please remove this section before publication</em></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/ioggstream/draft-polli-Retry-Scope">https://github.com/ioggstream/draft-polli-Retry-Scope</eref>.</t>
    </note>
  </front>
  <middle>
    <section anchor="introduction" numbered="true" toc="default">
      <name>Introduction</name>
      <t>The <xref target="DIGEST" format="default"/> defines a way to convey a checksum of a representation-data
as specified in <xref target="SEMANTICS" format="default"/>.</t>
      <t>As the representation data depends on the value of <tt>Content-Encoding</tt>, it is useful
to convey the checksum value of a representation without any content-coding applied.</t>
      <t>This proposal introduces the "id-" prefix
to specify that the provided digest-algorithm value is computed on the representation-data
without any content-coding applied.</t>
      <section anchor="notational-conventions" numbered="true" toc="default">
        <name>Notational Conventions</name>
        <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED",
"MAY", and "OPTIONAL" in this document are to be interpreted as
described in BCP&nbsp;14 <xref target="RFC2119" format="default"/> <xref target="RFC8174" format="default"/> when, and only when, they
appear in all capitals, as shown here.
These words may also appear in this document in
lower case as plain English words, absent their normative meanings.</t>
        <t>This document uses the Augmented BNF defined in <xref target="RFC5234" format="default"/> and updated
by <xref target="RFC7405" format="default"/>.</t>
        <t>The definitions "representation", "selected representation", "representation
data", "representation metadata", and "payload body" in this document are to be
interpreted as described in <xref target="SEMANTICS" format="default"/>.</t>
        <t>The definitions "digest-algorithm" and "representation-data-digest" in this document
are to be interpreted as described in <xref target="DIGEST" format="default"/>.</t>
      </section>
    </section>
    <section anchor="the-id-prefix-for-digest-algorithms" numbered="true" toc="default">
      <name>The "id-" prefix for digest-algorithms</name>
      <t>A digest-algorithm to be registered within the
<eref target="https://www.iana.org/assignments/http-dig-alg/http-dig-alg.xhtml">HTTP Digest Algorithm Values</eref>
MUST NOT start with the string "id-".</t>
      <t>The following two examples show two digest-algorithm names that cannot be registered</t>
      <artwork type="example" name="" align="left" alt=""><![CDATA[
   id-crc32c
   id-adler32
]]></artwork>
      <t>For every digest-algorithm registered in the 
<eref target="https://www.iana.org/assignments/http-dig-alg/http-dig-alg.xhtml">HTTP Digest Algorithm Values</eref>
the associate "id-" digest-algorithm has the following properties:</t>
      <ul spacing="normal">
        <li>the checksum is computed on the representation-data of the resource
when no content coding is applied;</li>
        <li>the checksum is computed according to the original digest-algorithm
Description field, and uses the same encoding of the original digest-algorithm.</li>
      </ul>
      <t>This definition is compatible, and thus extends, the definition
of the "id-sha-256" and "id-sha-512" digest-algorithms
contained in Section X of <xref target="DIGEST" format="default"/>.</t>
    </section>
    <section anchor="security-considerations" numbered="true" toc="default">
      <name>Security Considerations</name>
      <section anchor="disclosure-of-encrypted-content" numbered="true" toc="default">
        <name>Disclosure of encrypted content</name>
        <t>Like the "id-sha-256" digest-algoritm defined in <xref target="DIGEST" format="default"/>
if the content-coding provides encryption features,
sending the checksum of unencoded representation can
disclose information.</t>
      </section>
    </section>
    <section anchor="iana-considerations" numbered="true" toc="default">
      <name>IANA Considerations</name>
      <section anchor="tbd-how-to-reserve-id-prefix" numbered="true" toc="default">
        <name>TBD how to reserve "id-" prefix?</name>
      </section>
    </section>
    <section anchor="examples" numbered="true" toc="default">
      <name>Examples</name>
      <section anchor="the-id-crc32c-digest-algorithm" numbered="true" toc="default">
        <name>The id-crc32c digest-algorithm</name>
        <t>The following request conveys a brotli encoded
json object</t>
        <artwork type="example" name="" align="left" alt=""><![CDATA[
{"hello": "world"}
]]></artwork>
        <t>The <tt>Digest</tt> computed using the "crc32c" digest-algorithm present in 
<eref target="https://www.iana.org/assignments/http-dig-alg/http-dig-alg.xhtml">HTTP Digest Algorithm Values</eref>
is content-coding aware,
while its associated "id-" digest-algorithm is not "id-crc32c"</t>
        <artwork type="example" name="" align="left" alt=""><![CDATA[
POST /data HTTP/1.1
Content-Type: application/json
Content-Encoding: br
Digest: id-crc32c=43794720, crc32c=DB329237

CwGAZG9nAw==
]]></artwork>
      </section>
    </section>
  </middle>
  <back>
    <references>
      <name>Normative References</name>
      <reference anchor="DIGEST" target="http://www.ietf.org/internet-drafts/draft-ietf-httpbis-digest-headers-04.txt">
        <front>
          <title>Digest Headers</title>
          <author initials="R" surname="Polli" fullname="Roberto Polli">
            <organization/>
          </author>
          <author initials="L" surname="Pardue" fullname="Lucas Pardue">
            <organization/>
          </author>
          <date month="October" day="17" year="2020"/>
          <abstract>
            <t>This document defines the HTTP Digest and Want-Digest fields, thus allowing client and server to negotiate an integrity checksum of the exchanged resource representation data.  This document obsoletes RFC 3230.  It replaces the term "instance" with "representation", which makes it consistent with the HTTP Semantic and Context defined in draft-ietf-httpbis-semantics.</t>
          </abstract>
        </front>
        <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-digest-headers-04"/>
      </reference>
      <reference anchor="SEMANTICS" 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="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="RFC8174" target="https://www.rfc-editor.org/info/rfc8174">
        <front>
          <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
          <author initials="B." surname="Leiba" fullname="B. Leiba">
            <organization/>
          </author>
          <date year="2017" month="May"/>
          <abstract>
            <t>RFC 2119 specifies common key words that may be used in protocol  specifications.  This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the  defined special meanings.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="8174"/>
        <seriesInfo name="DOI" value="10.17487/RFC8174"/>
      </reference>
      <reference anchor="RFC5234" target="https://www.rfc-editor.org/info/rfc5234">
        <front>
          <title>Augmented BNF for Syntax Specifications: ABNF</title>
          <author initials="D." surname="Crocker" fullname="D. Crocker" role="editor">
            <organization/>
          </author>
          <author initials="P." surname="Overell" fullname="P. Overell">
            <organization/>
          </author>
          <date year="2008" month="January"/>
          <abstract>
            <t>Internet technical specifications often need to define a formal syntax.  Over the years, a modified version of Backus-Naur Form (BNF), called Augmented BNF (ABNF), has been popular among many Internet specifications.  The current specification documents ABNF. It balances compactness and simplicity with reasonable representational power.  The differences between standard BNF and ABNF involve naming rules, repetition, alternatives, order-independence, and value ranges.  This specification also supplies additional rule definitions and encoding for a core lexical analyzer of the type common to several Internet specifications.  [STANDARDS-TRACK]</t>
          </abstract>
        </front>
        <seriesInfo name="STD" value="68"/>
        <seriesInfo name="RFC" value="5234"/>
        <seriesInfo name="DOI" value="10.17487/RFC5234"/>
      </reference>
      <reference anchor="RFC7405" target="https://www.rfc-editor.org/info/rfc7405">
        <front>
          <title>Case-Sensitive String Support in ABNF</title>
          <author initials="P." surname="Kyzivat" fullname="P. Kyzivat">
            <organization/>
          </author>
          <date year="2014" month="December"/>
          <abstract>
            <t>This document extends the base definition of ABNF (Augmented Backus-Naur Form) to include a way to specify US-ASCII string literals that are matched in a case-sensitive manner.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="7405"/>
        <seriesInfo name="DOI" value="10.17487/RFC7405"/>
      </reference>
    </references>
    <section anchor="acknowledgements" numbered="true" toc="default">
      <name>Acknowledgements</name>
      <t>This specification was born from a thread created by James Manger
and the subsequent discussion here https://github.com/httpwg/http-extensions/issues/885.</t>
    </section>
    <section numbered="false" anchor="faq" toc="default">
      <name>FAQ</name>
      <dl>
        <dt>
Q: Question 1  </dt>
        <dd>
          <t>Answer 1</t>
        </dd>
      </dl>
    </section>
    <section numbered="false" anchor="code-samples" toc="default">
      <name>Code Samples</name>
      <t><em>RFC Editor: Please remove this section before publication.</em></t>
      <t>How can I generate and validate the <tt>Digest</tt> values shown in the examples
throughout this document?</t>
      <t>The following python3 code can be used to generate digests for json objects
using crc32c algorithm. Note that these are formatted as
base64. This function could be adapted to other algorithms and should take into
account their specific formatting rules.</t>
      <artwork name="" type="" align="left" alt=""><![CDATA[
import base64, json, brotli, crc32c

identity = lambda x: x

def digest(item, content_coding=identity, algorithm=crc32c.crc32c):
    json_bytes = json.dumps(item).encode()
    content_encoded = content_coding(json_bytes)
    checksum = algorithm(content_encoded)
    # encode result has uppercase hex
    return hex(checksum)[2:].upper()


item = {"hello": "world"}

print("crc32c digest value for a br-coded representation: ",
    digest(item, content_coding=brotli.compress)
)

print("id-crc32c digest value for a br-coded representation: ",
    digest(item, content_coding=identity)
)

]]></artwork>
    </section>
    <section numbered="false" anchor="change-log" toc="default">
      <name>Change Log</name>
      <t>RFC EDITOR PLEASE DELETE THIS SECTION.</t>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIACAi3V8AA7VY63LbuBX+j6dAlT92RpdYdtYJW3VXsZTEHd9iKZ22mYwD
kZCENUlwAdCyxpM8S5+lT9bvAKRkSU5mO9PND4cEce7nfOcctVot5pRLZcTH
c8kbKmk1eGHkVN3zqTZ8oGbSOt5PZ9ooN88sE5OJkXcRS3Sciwx0iRFT1yp0
mqoWyBNP0RIritaLAxYLJ/G+jLh1CWOqMBF3prSu++LF6xddJowUEX8nc2lE
yhba3M6MLouI3col3pKIn+ZOmly61oDEMWadyJMbkeocKiylZYWK+Cen4ybH
H5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