<?xml version='1.0' encoding='utf-8'?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" version="3" category="std" consensus="true" docName="draft-ietf-dnsop-rfc2845bis-09" indexInclude="true" ipr="pre5378Trust200902" number="8945" obsoletes="2845, 4635" prepTime="2020-11-30T14:56:44" scripts="Common,Latin" sortRefs="true" submissionType="IETF" symRefs="true" tocDepth="3" tocInclude="true" xml:lang="en">
  <link href="https://datatracker.ietf.org/doc/draft-ietf-dnsop-rfc2845bis-09" rel="prev"/>
  <link href="https://dx.doi.org/10.17487/rfc8945" rel="alternate"/>
  <link href="urn:issn:2070-1721" rel="alternate"/>
  <front>
    <title abbrev="DNS TSIG">Secret Key Transaction Authentication for DNS (TSIG)</title>
    <seriesInfo name="RFC" value="8945" stream="IETF"/>
    <seriesInfo name="STD" value="93" stream="IETF"/>
    <author fullname="Francis Dupont" initials="F" surname="Dupont">
      <organization abbrev="ISC" showOnFrontPage="true">Internet Systems Consortium, Inc.</organization>
      <address>
        <postal>
          <street>PO Box 360</street>
          <city>Newmarket</city>
          <region>NH</region>
          <code>03857</code>
          <country>United States of America</country>
        </postal>
        <email>Francis.Dupont@fdupont.fr</email>
      </address>
    </author>
    <author fullname="Stephen Morris" initials="S" surname="Morris">
      <organization abbrev="Unaffiliated" showOnFrontPage="true">Unaffiliated</organization>
      <address>
        <postal>
          <country>United Kingdom</country>
        </postal>
        <email>sa.morris8@gmail.com</email>
      </address>
    </author>
    <author fullname="Paul Vixie" initials="P" surname="Vixie">
      <organization abbrev="Farsight" showOnFrontPage="true">Farsight Security Inc</organization>
      <address>
        <postal>
          <street>177 Bovet Road</street>
          <extaddr>Suite 180</extaddr>
          <city>San Mateo</city>
          <region>CA</region>
          <code>94402</code>
          <country>United States of America</country>
        </postal>
        <email>paul@redbarn.org</email>
      </address>
    </author>
    <author fullname="Donald E. Eastlake 3rd" initials="D" surname="Eastlake 3rd">
      <organization abbrev="Futurewei" showOnFrontPage="true">Futurewei Technologies</organization>
      <address>
        <postal>
          <street>2386 Panoramic Circle</street>
          <city>Apopka</city>
          <region>FL</region>
          <code>32703</code>
          <country>United States of America</country>
        </postal>
        <email>d3e3e3@gmail.com</email>
      </address>
    </author>
    <author fullname="Olafur Gudmundsson" initials="O" surname="Gudmundsson">
      <organization abbrev="Cloudflare" showOnFrontPage="true">Cloudflare</organization>
      <address>
        <postal>
          <street/>
          <city/>
          <region/>
          <code/>
          <country>United States of America</country>
        </postal>
        <email>olafur+ietf@cloudflare.com</email>
      </address>
    </author>
    <author fullname="Brian Wellington" initials="B" surname="Wellington">
      <organization abbrev="Akamai" showOnFrontPage="true">Akamai</organization>
      <address>
        <postal>
          <street/>
          <country>United States of America</country>
        </postal>
        <email>bwelling@akamai.com</email>
      </address>
    </author>
    <date month="11" year="2020"/>
    <area>Operations and Management Area</area>
    <workgroup>Internet Engineering Task Force</workgroup>
    <abstract pn="section-abstract">
      <t indent="0" pn="section-abstract-1">This document describes a protocol for transaction-level authentication
      using shared secrets and one-way hashing.  It can be used to authenticate
      dynamic updates to a DNS zone as coming from an approved client or to
      authenticate responses as coming from an approved name server.</t>
      <t indent="0" pn="section-abstract-2">No recommendation is made here for distributing the shared secrets;
      it is expected that a network administrator will statically configure
      name servers and clients using some out-of-band mechanism.</t>
      <t indent="0" pn="section-abstract-3">This document obsoletes RFCs 2845 and 4635.</t>
    </abstract>
    <boilerplate>
      <section anchor="status-of-memo" numbered="false" removeInRFC="false" toc="exclude" pn="section-boilerplate.1">
        <name slugifiedName="name-status-of-this-memo">Status of This Memo</name>
        <t indent="0" pn="section-boilerplate.1-1">
            This is an Internet Standards Track document.
        </t>
        <t indent="0" pn="section-boilerplate.1-2">
            This document is a product of the Internet Engineering Task Force
            (IETF).  It represents the consensus of the IETF community.  It has
            received public review and has been approved for publication by
            the Internet Engineering Steering Group (IESG).  Further
            information on Internet Standards is available in Section 2 of 
            RFC 7841.
        </t>
        <t indent="0" pn="section-boilerplate.1-3">
            Information about the current status of this document, any
            errata, and how to provide feedback on it may be obtained at
            <eref target="https://www.rfc-editor.org/info/rfc8945" brackets="none"/>.
        </t>
      </section>
      <section anchor="copyright" numbered="false" removeInRFC="false" toc="exclude" pn="section-boilerplate.2">
        <name slugifiedName="name-copyright-notice">Copyright Notice</name>
        <t indent="0" pn="section-boilerplate.2-1">
            Copyright (c) 2020 IETF Trust and the persons identified as the
            document authors. All rights reserved.
        </t>
        <t indent="0" pn="section-boilerplate.2-2">
            This document is subject to BCP 78 and the IETF Trust's Legal
            Provisions Relating to IETF Documents
            (<eref target="https://trustee.ietf.org/license-info" brackets="none"/>) in effect on the date of
            publication of this document. Please review these documents
            carefully, as they describe your rights and restrictions with
            respect to this document. Code Components extracted from this
            document must include Simplified BSD License text as described in
            Section 4.e of the Trust Legal Provisions and are provided without
            warranty as described in the Simplified BSD License.
        </t>
        <t indent="0" pn="section-boilerplate.2-3">
            This document may contain material from IETF Documents or IETF
            Contributions published or made publicly available before November
            10, 2008. The person(s) controlling the copyright in some of this
            material may not have granted the IETF Trust the right to allow
            modifications of such material outside the IETF Standards Process.
            Without obtaining an adequate license from the person(s)
            controlling the copyright in such materials, this document may not
            be modified outside the IETF Standards Process, and derivative
            works of it may not be created outside the IETF Standards Process,
            except to format it for publication as an RFC or to translate it
            into languages other than English.
        </t>
      </section>
    </boilerplate>
    <toc>
      <section anchor="toc" numbered="false" removeInRFC="false" toc="exclude" pn="section-toc.1">
        <name slugifiedName="name-table-of-contents">Table of Contents</name>
        <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1">
          <li pn="section-toc.1-1.1">
            <t indent="0" pn="section-toc.1-1.1.1"><xref derivedContent="1" format="counter" sectionFormat="of" target="section-1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-introduction">Introduction</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.1.2">
              <li pn="section-toc.1-1.1.2.1">
                <t indent="0" keepWithNext="true" pn="section-toc.1-1.1.2.1.1"><xref derivedContent="1.1" format="counter" sectionFormat="of" target="section-1.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-background">Background</xref></t>
              </li>
              <li pn="section-toc.1-1.1.2.2">
                <t indent="0" keepWithNext="true" pn="section-toc.1-1.1.2.2.1"><xref derivedContent="1.2" format="counter" sectionFormat="of" target="section-1.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-protocol-overview">Protocol Overview</xref></t>
              </li>
              <li pn="section-toc.1-1.1.2.3">
                <t indent="0" keepWithNext="true" pn="section-toc.1-1.1.2.3.1"><xref derivedContent="1.3" format="counter" sectionFormat="of" target="section-1.3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-document-history">Document History</xref></t>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.2">
            <t indent="0" pn="section-toc.1-1.2.1"><xref derivedContent="2" format="counter" sectionFormat="of" target="section-2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-key-words">Key Words</xref></t>
          </li>
          <li pn="section-toc.1-1.3">
            <t indent="0" pn="section-toc.1-1.3.1"><xref derivedContent="3" format="counter" sectionFormat="of" target="section-3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-assigned-numbers">Assigned Numbers</xref></t>
          </li>
          <li pn="section-toc.1-1.4">
            <t indent="0" pn="section-toc.1-1.4.1"><xref derivedContent="4" format="counter" sectionFormat="of" target="section-4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-tsig-rr-format">TSIG RR Format</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.4.2">
              <li pn="section-toc.1-1.4.2.1">
                <t indent="0" pn="section-toc.1-1.4.2.1.1"><xref derivedContent="4.1" format="counter" sectionFormat="of" target="section-4.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-tsig-rr-type">TSIG RR Type</xref></t>
              </li>
              <li pn="section-toc.1-1.4.2.2">
                <t indent="0" pn="section-toc.1-1.4.2.2.1"><xref derivedContent="4.2" format="counter" sectionFormat="of" target="section-4.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-tsig-record-format">TSIG Record Format</xref></t>
              </li>
              <li pn="section-toc.1-1.4.2.3">
                <t indent="0" pn="section-toc.1-1.4.2.3.1"><xref derivedContent="4.3" format="counter" sectionFormat="of" target="section-4.3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-mac-computation">MAC Computation</xref></t>
                <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.4.2.3.2">
                  <li pn="section-toc.1-1.4.2.3.2.1">
                    <t indent="0" pn="section-toc.1-1.4.2.3.2.1.1"><xref derivedContent="4.3.1" format="counter" sectionFormat="of" target="section-4.3.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-request-mac">Request MAC</xref></t>
                  </li>
                  <li pn="section-toc.1-1.4.2.3.2.2">
                    <t indent="0" pn="section-toc.1-1.4.2.3.2.2.1"><xref derivedContent="4.3.2" format="counter" sectionFormat="of" target="section-4.3.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-dns-message">DNS Message</xref></t>
                  </li>
                  <li pn="section-toc.1-1.4.2.3.2.3">
                    <t indent="0" pn="section-toc.1-1.4.2.3.2.3.1"><xref derivedContent="4.3.3" format="counter" sectionFormat="of" target="section-4.3.3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-tsig-variables">TSIG Variables</xref></t>
                  </li>
                </ul>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.5">
            <t indent="0" pn="section-toc.1-1.5.1"><xref derivedContent="5" format="counter" sectionFormat="of" target="section-5"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-protocol-details">Protocol Details</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.5.2">
              <li pn="section-toc.1-1.5.2.1">
                <t indent="0" pn="section-toc.1-1.5.2.1.1"><xref derivedContent="5.1" format="counter" sectionFormat="of" target="section-5.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-generation-of-tsig-on-reque">Generation of TSIG on Requests</xref></t>
              </li>
              <li pn="section-toc.1-1.5.2.2">
                <t indent="0" pn="section-toc.1-1.5.2.2.1"><xref derivedContent="5.2" format="counter" sectionFormat="of" target="section-5.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-server-processing-of-reques">Server Processing of Request</xref></t>
                <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.5.2.2.2">
                  <li pn="section-toc.1-1.5.2.2.2.1">
                    <t indent="0" pn="section-toc.1-1.5.2.2.2.1.1"><xref derivedContent="5.2.1" format="counter" sectionFormat="of" target="section-5.2.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-key-check-and-error-handlin">Key Check and Error Handling</xref></t>
                  </li>
                  <li pn="section-toc.1-1.5.2.2.2.2">
                    <t indent="0" pn="section-toc.1-1.5.2.2.2.2.1"><xref derivedContent="5.2.2" format="counter" sectionFormat="of" target="section-5.2.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-mac-check-and-error-handlin">MAC Check and Error Handling</xref></t>
                  </li>
                  <li pn="section-toc.1-1.5.2.2.2.3">
                    <t indent="0" pn="section-toc.1-1.5.2.2.2.3.1"><xref derivedContent="5.2.3" format="counter" sectionFormat="of" target="section-5.2.3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-time-check-and-error-handli">Time Check and Error Handling</xref></t>
                  </li>
                  <li pn="section-toc.1-1.5.2.2.2.4">
                    <t indent="0" pn="section-toc.1-1.5.2.2.2.4.1"><xref derivedContent="5.2.4" format="counter" sectionFormat="of" target="section-5.2.4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-truncation-check-and-error-">Truncation Check and Error Handling</xref></t>
                  </li>
                </ul>
              </li>
              <li pn="section-toc.1-1.5.2.3">
                <t indent="0" pn="section-toc.1-1.5.2.3.1"><xref derivedContent="5.3" format="counter" sectionFormat="of" target="section-5.3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-generation-of-tsig-on-answe">Generation of TSIG on Answers</xref></t>
                <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.5.2.3.2">
                  <li pn="section-toc.1-1.5.2.3.2.1">
                    <t indent="0" pn="section-toc.1-1.5.2.3.2.1.1"><xref derivedContent="5.3.1" format="counter" sectionFormat="of" target="section-5.3.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-tsig-on-tcp-connections">TSIG on TCP Connections</xref></t>
                  </li>
                  <li pn="section-toc.1-1.5.2.3.2.2">
                    <t indent="0" pn="section-toc.1-1.5.2.3.2.2.1"><xref derivedContent="5.3.2" format="counter" sectionFormat="of" target="section-5.3.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-generation-of-tsig-on-error">Generation of TSIG on Error Returns</xref></t>
                  </li>
                </ul>
              </li>
              <li pn="section-toc.1-1.5.2.4">
                <t indent="0" pn="section-toc.1-1.5.2.4.1"><xref derivedContent="5.4" format="counter" sectionFormat="of" target="section-5.4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-client-processing-of-answer">Client Processing of Answer</xref></t>
                <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.5.2.4.2">
                  <li pn="section-toc.1-1.5.2.4.2.1">
                    <t indent="0" pn="section-toc.1-1.5.2.4.2.1.1"><xref derivedContent="5.4.1" format="counter" sectionFormat="of" target="section-5.4.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-key-error-handling">Key Error Handling</xref></t>
                  </li>
                  <li pn="section-toc.1-1.5.2.4.2.2">
                    <t indent="0" pn="section-toc.1-1.5.2.4.2.2.1"><xref derivedContent="5.4.2" format="counter" sectionFormat="of" target="section-5.4.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-mac-error-handling">MAC Error Handling</xref></t>
                  </li>
                  <li pn="section-toc.1-1.5.2.4.2.3">
                    <t indent="0" pn="section-toc.1-1.5.2.4.2.3.1"><xref derivedContent="5.4.3" format="counter" sectionFormat="of" target="section-5.4.3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-time-error-handling">Time Error Handling</xref></t>
                  </li>
                  <li pn="section-toc.1-1.5.2.4.2.4">
                    <t indent="0" pn="section-toc.1-1.5.2.4.2.4.1"><xref derivedContent="5.4.4" format="counter" sectionFormat="of" target="section-5.4.4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-truncation-error-handling">Truncation Error Handling</xref></t>
                  </li>
                </ul>
              </li>
              <li pn="section-toc.1-1.5.2.5">
                <t indent="0" pn="section-toc.1-1.5.2.5.1"><xref derivedContent="5.5" format="counter" sectionFormat="of" target="section-5.5"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-special-considerations-for-">Special Considerations for Forwarding Servers</xref></t>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.6">
            <t indent="0" pn="section-toc.1-1.6.1"><xref derivedContent="6" format="counter" sectionFormat="of" target="section-6"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-algorithms-and-identifiers">Algorithms and Identifiers</xref></t>
          </li>
          <li pn="section-toc.1-1.7">
            <t indent="0" pn="section-toc.1-1.7.1"><xref derivedContent="7" format="counter" sectionFormat="of" target="section-7"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-tsig-truncation-policy">TSIG Truncation Policy</xref></t>
          </li>
          <li pn="section-toc.1-1.8">
            <t indent="0" pn="section-toc.1-1.8.1"><xref derivedContent="8" format="counter" sectionFormat="of" target="section-8"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-shared-secrets">Shared Secrets</xref></t>
          </li>
          <li pn="section-toc.1-1.9">
            <t indent="0" pn="section-toc.1-1.9.1"><xref derivedContent="9" format="counter" sectionFormat="of" target="section-9"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-iana-considerations">IANA Considerations</xref></t>
          </li>
          <li pn="section-toc.1-1.10">
            <t indent="0" pn="section-toc.1-1.10.1"><xref derivedContent="10" format="counter" sectionFormat="of" target="section-10"/>. <xref derivedContent="" format="title" sectionFormat="of" target="name-security-considerations">Security Considerations</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.10.2">
              <li pn="section-toc.1-1.10.2.1">
                <t indent="0" pn="section-toc.1-1.10.2.1.1"><xref derivedContent="10.1" format="counter" sectionFormat="of" target="section-10.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-issue-fixed-in-this-documen">Issue Fixed in This Document</xref></t>
              </li>
              <li pn="section-toc.1-1.10.2.2">
                <t indent="0" pn="section-toc.1-1.10.2.2.1"><xref derivedContent="10.2" format="counter" sectionFormat="of" target="section-10.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-why-not-dnssec">Why Not DNSSEC?</xref></t>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.11">
            <t indent="0" pn="section-toc.1-1.11.1"><xref derivedContent="11" format="counter" sectionFormat="of" target="section-11"/>. <xref derivedContent="" format="title" sectionFormat="of" target="name-references">References</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.11.2">
              <li pn="section-toc.1-1.11.2.1">
                <t indent="0" pn="section-toc.1-1.11.2.1.1"><xref derivedContent="11.1" format="counter" sectionFormat="of" target="section-11.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-normative-references">Normative References</xref></t>
              </li>
              <li pn="section-toc.1-1.11.2.2">
                <t indent="0" pn="section-toc.1-1.11.2.2.1"><xref derivedContent="11.2" format="counter" sectionFormat="of" target="section-11.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-informative-references">Informative References</xref></t>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.12">
            <t indent="0" pn="section-toc.1-1.12.1"><xref derivedContent="" format="none" sectionFormat="of" target="section-appendix.a"/><xref derivedContent="" format="title" sectionFormat="of" target="name-acknowledgements">Acknowledgements</xref></t>
          </li>
          <li pn="section-toc.1-1.13">
            <t indent="0" pn="section-toc.1-1.13.1"><xref derivedContent="" format="none" sectionFormat="of" target="section-appendix.b"/><xref derivedContent="" format="title" sectionFormat="of" target="name-authors-addresses">Authors' Addresses</xref></t>
          </li>
        </ul>
      </section>
    </toc>
  </front>
  <middle>
    <section numbered="true" toc="include" removeInRFC="false" pn="section-1">
      <name slugifiedName="name-introduction">Introduction</name>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-1.1">
        <name slugifiedName="name-background">Background</name>
        <t indent="0" pn="section-1.1-1">The Domain Name System (DNS) (<xref target="RFC1034" format="default" sectionFormat="of" derivedContent="RFC1034"/> <xref target="RFC1035" format="default" sectionFormat="of" derivedContent="RFC1035"/>) is a
	replicated hierarchical distributed 
        database system that provides information fundamental to Internet
        operations, such as name-to-address translation and mail-handling
	information.</t>
        <t indent="0" pn="section-1.1-2">This document specifies use of a message authentication code
        (MAC), generated using certain keyed hash functions, to
        provide an efficient means of point-to-point authentication and
        integrity checking for DNS transactions. Such transactions include
        DNS update requests and responses for which this can provide a lightweight
        alternative to the secure DNS dynamic update protocol described by
	<xref target="RFC3007" format="default" sectionFormat="of" derivedContent="RFC3007"/>.</t>
        <t indent="0" pn="section-1.1-3">A further use of this mechanism is to protect zone transfers.
        In this case, the data covered would be the whole zone transfer
        including any glue records sent.  The protocol described by DNSSEC
        (<xref target="RFC4033" format="default" sectionFormat="of" derivedContent="RFC4033"/>, <xref target="RFC4034" format="default" sectionFormat="of" derivedContent="RFC4034"/>,
        <xref target="RFC4035" format="default" sectionFormat="of" derivedContent="RFC4035"/>) does not protect glue records and unsigned
        records.</t>
        <t indent="0" pn="section-1.1-4">The authentication mechanism proposed here provides a
        simple and efficient authentication between clients and servers,
        by using shared secret keys to establish a trust relationship between
        two entities.  Such keys must be protected in a manner similar to
        private keys, lest a third party masquerade as one of the intended
        parties (by forging the MAC).  The proposal is unsuitable for general
        server-to-server authentication and for servers that speak with many
        other servers, since key management would become unwieldy with the
        number of shared keys going up quadratically. But it is suitable for
        many resolvers on hosts that only talk to a few recursive servers.</t>
      </section>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-1.2">
        <name slugifiedName="name-protocol-overview">Protocol Overview</name>
        <t indent="0" pn="section-1.2-1">Secret Key Transaction Authentication makes use of signatures
         on messages sent between the parties involved (e.g., resolver and
         server).  These are known as "transaction signatures", or TSIG.
         For historical reasons, in this document, they are referred to as
         message authentication codes (MACs).</t>
        <t indent="0" pn="section-1.2-2">Use of TSIG presumes prior agreement between the
         two parties involved (e.g., resolver and server) as to any
         algorithm and key to be used.  The way that this agreement
         is reached is outside the scope of the document.</t>
        <t indent="0" pn="section-1.2-3">A DNS message exchange involves the sending of a query and the
         receipt of one of more DNS messages in response.  For
         the query, the MAC is calculated based on the hash of the contents
         and the agreed TSIG key.  The MAC for the response is similar but
         also includes the MAC of the query as part of the calculation.
         Where a response comprises multiple packets, the calculation of
         the MAC associated with the second and subsequent packets includes in
         its inputs the MAC for the preceding packet.
         In this way, it is possible to detect any interruption in the
         packet sequence, although not its premature termination.</t>
        <t indent="0" pn="section-1.2-4">The MAC is contained in a TSIG resource record included
         in the additional section of the DNS message.</t>
      </section>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-1.3">
        <name slugifiedName="name-document-history">Document History</name>
        <t indent="0" pn="section-1.3-1">TSIG was originally specified by <xref target="RFC2845" format="default" sectionFormat="of" derivedContent="RFC2845"/>.
         In 2017, two name server implementations strictly following that document (and
         the related  <xref target="RFC4635" format="default" sectionFormat="of" derivedContent="RFC4635"/>) were discovered to have
         security problems related to this feature (<xref target="CVE-2017-3142" format="default" sectionFormat="of" derivedContent="CVE-2017-3142"/>, 
         <xref target="CVE-2017-3143" format="default" sectionFormat="of" derivedContent="CVE-2017-3143"/>, <xref target="CVE-2017-11104" format="default" sectionFormat="of" derivedContent="CVE-2017-11104"/>).  The implementations 
         were fixed, but to avoid similar problems in the future, the
         two documents were updated and merged, producing this revised
         specification for TSIG.</t>
        <t indent="0" pn="section-1.3-2">While TSIG implemented according to this RFC provides for enhanced
         security, there are no changes in interoperability. TSIG on the wire
         is still the same mechanism described in <xref target="RFC2845" format="default" sectionFormat="of" derivedContent="RFC2845"/>; only the checking semantics have been
	 changed. 

	 See <xref target="issuesfixed" format="default" sectionFormat="of" derivedContent="Section 10.1"/> for
	further details.</t>
      </section>
    </section>
    <section anchor="keywords" numbered="true" toc="include" removeInRFC="false" pn="section-2">
      <name slugifiedName="name-key-words">Key Words</name>
      <t indent="0" pn="section-2-1">
    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>NOT RECOMMENDED</bcp14>", 
    "<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are
    to be interpreted as 
    described in BCP 14 <xref target="RFC2119" format="default" sectionFormat="of" derivedContent="RFC2119"/> <xref target="RFC8174" format="default" sectionFormat="of" derivedContent="RFC8174"/> 
    when, and only when, they appear in all capitals, as shown here.
      </t>
    </section>
    <section anchor="numbers" numbered="true" toc="include" removeInRFC="false" pn="section-3">
      <name slugifiedName="name-assigned-numbers">Assigned Numbers</name>
      <t indent="0" pn="section-3-1">This document defines the following Resource Record (RR) type and
      associated value:</t>
      <ul empty="true" bare="false" indent="3" spacing="normal" pn="section-3-2">
        <li pn="section-3-2.1">TSIG (250)</li>
      </ul>
      <t indent="0" pn="section-3-3">In addition, the document also defines the following DNS RCODEs
      and associated names:</t>
      <ul empty="true" spacing="compact" bare="false" indent="3" pn="section-3-4">
        <li pn="section-3-4.1">16 (BADSIG)</li>
        <li pn="section-3-4.2">17 (BADKEY)</li>
        <li pn="section-3-4.3">18 (BADTIME)</li>
        <li pn="section-3-4.4">22 (BADTRUNC)</li>
      </ul>
      <t indent="0" pn="section-3-5">(See <xref target="RFC6895" sectionFormat="of" section="2.3" format="default" derivedLink="https://rfc-editor.org/rfc/rfc6895#section-2.3" derivedContent="RFC6895"/>
      concerning the assignment of the value 16 to BADSIG.)</t>
      <t indent="0" pn="section-3-6">These RCODES may appear within the "Error" field of a TSIG RR.</t>
    </section>
    <section numbered="true" toc="include" removeInRFC="false" pn="section-4">
      <name slugifiedName="name-tsig-rr-format">TSIG RR Format</name>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-4.1">
        <name slugifiedName="name-tsig-rr-type">TSIG RR Type</name>
        <t indent="0" pn="section-4.1-1">To provide secret key authentication, we use an RR
        type whose mnemonic is TSIG and whose type code is 250.
        TSIG is a meta-RR and <bcp14>MUST NOT</bcp14> be cached.  TSIG RRs are
        used for authentication between DNS entities that have
        established a shared secret key.  TSIG RRs are dynamically
        computed to cover a particular DNS transaction and are not
        DNS RRs in the usual sense.</t>
        <t indent="0" pn="section-4.1-2">As the TSIG RRs are related to one DNS request/response,
        there is no value in storing or retransmitting them; thus, the
        TSIG RR is discarded once it has been used to authenticate a DNS
        message.</t>
      </section>
      <section anchor="format" numbered="true" toc="include" removeInRFC="false" pn="section-4.2">
        <name slugifiedName="name-tsig-record-format">TSIG Record Format</name>
        <t indent="0" pn="section-4.2-1">The fields of the TSIG RR are described below.  All multi-octet integers in the record are sent in network byte
        order (see <xref target="RFC1035" sectionFormat="of" section="2.3.2" format="default" derivedLink="https://rfc-editor.org/rfc/rfc1035#section-2.3.2" derivedContent="RFC1035"/>).</t>
        <dl newline="false" spacing="normal" indent="3" pn="section-4.2-2">
          <dt pn="section-4.2-2.1">NAME:</dt>
          <dd pn="section-4.2-2.2">
            <t indent="0" pn="section-4.2-2.2.1">The name of the key used, in domain
          name syntax.  The name should reflect the names of the
          hosts and uniquely identify the key among a set of keys
          these two hosts may share at any given time.  For example,
          if hosts
          A.site.example and B.example.net share a key, possibilities
          for the key name include &lt;id&gt;.A.site.example,
          &lt;id&gt;.B.example.net, and
          &lt;id&gt;.A.site.example.B.example.net.  It should be
          possible for more than one key to be in simultaneous use
          among a set of interacting hosts. This allows for periodic
          key rotation as per best operational practices, as well as
          algorithm agility as indicated by <xref target="RFC7696" format="default" sectionFormat="of" derivedContent="RFC7696"/>.</t>
            <t indent="0" pn="section-4.2-2.2.2">The name may be used as a local index
          to the key involved, but it is recommended that it be
          globally unique.  Where a key is just shared between two
          hosts, its name actually need only be meaningful to
          them, but it is recommended that the key name be mnemonic
          and incorporate the names of participating agents or
          resources as suggested above.</t>
          </dd>
          <dt pn="section-4.2-2.3">TYPE:</dt>
          <dd pn="section-4.2-2.4">This <bcp14>MUST</bcp14> be TSIG (250: Transaction SIGnature).</dd>
          <dt pn="section-4.2-2.5">CLASS:</dt>
          <dd pn="section-4.2-2.6">This <bcp14>MUST</bcp14> be ANY.</dd>
          <dt pn="section-4.2-2.7">TTL:</dt>
          <dd pn="section-4.2-2.8">This <bcp14>MUST</bcp14> be 0.</dd>
          <dt pn="section-4.2-2.9">RDLENGTH:</dt>
          <dd pn="section-4.2-2.10">(variable)</dd>
          <dt pn="section-4.2-2.11">RDATA:</dt>
          <dd pn="section-4.2-2.12">The RDATA for a TSIG RR consists of a
          number of fields, described below:</dd>
        </dl>
        <artwork name="" type="" align="left" alt="" pn="section-4.2-3">
                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    /                         Algorithm Name                        /
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                                                               |
    |          Time Signed          +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                               |            Fudge              |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |          MAC Size             |                               /
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+             MAC               /
    /                                                               /
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |          Original ID          |            Error              |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |          Other Len            |                               /
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+           Other Data          /
    /                                                               /
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
</artwork>
        <t indent="0" pn="section-4.2-4">The contents of the RDATA fields are:</t>
        <dl newline="true" spacing="normal" indent="3" pn="section-4.2-5">
          <dt pn="section-4.2-5.1">Algorithm Name:</dt>
          <dd pn="section-4.2-5.2">an octet sequence identifying the TSIG algorithm in the
	  domain name syntax. (Allowed names are listed in <xref target="allowed-algorithms" format="default" sectionFormat="of" derivedContent="Table 3"/>.) The name is stored
	  in the DNS name wire format as described in <xref target="RFC1034" format="default" sectionFormat="of" derivedContent="RFC1034"/>. As per <xref target="RFC3597" format="default" sectionFormat="of" derivedContent="RFC3597"/>, this name <bcp14>MUST NOT</bcp14> be
	  compressed.</dd>
          <dt pn="section-4.2-5.3">Time Signed:</dt>
          <dd pn="section-4.2-5.4">an unsigned 48-bit integer containing the time the message was
	  signed as seconds since 00:00 on 1970-01-01 UTC, ignoring leap
	  seconds.</dd>
          <dt pn="section-4.2-5.5">Fudge:</dt>
          <dd pn="section-4.2-5.6">an unsigned 16-bit integer specifying the allowed time
	  difference in seconds permitted in the Time Signed field.</dd>
          <dt pn="section-4.2-5.7">MAC Size:</dt>
          <dd pn="section-4.2-5.8">an unsigned 16-bit integer giving the length of the MAC field in
	  octets.  Truncation is indicated by a MAC Size less than the size of
	  the keyed hash produced by the algorithm specified by the Algorithm
	  Name.</dd>
          <dt pn="section-4.2-5.9">MAC:</dt>
          <dd pn="section-4.2-5.10">a sequence of octets whose contents are defined by the TSIG
	  algorithm used, possibly truncated as specified by the MAC Size. The
	  length of this field is given by the MAC Size. Calculation of the
	  MAC is detailed in <xref target="mac_computation" format="default" sectionFormat="of" derivedContent="Section 4.3"/>.</dd>
          <dt pn="section-4.2-5.11">Original ID:</dt>
          <dd pn="section-4.2-5.12">an unsigned 16-bit integer holding the message ID of the
	  original request message. For a TSIG RR on a request, it is set
	  equal to the DNS message ID. In a TSIG attached to a response -- or
	  in cases such as the forwarding of a dynamic update request -- the
	  field contains the ID of the original DNS request.</dd>
          <dt pn="section-4.2-5.13">Error:</dt>
          <dd pn="section-4.2-5.14">in responses, an unsigned 16-bit integer containing the extended
	  RCODE covering TSIG processing.  In requests, this
	  <bcp14>MUST</bcp14> be zero.</dd>
          <dt pn="section-4.2-5.15">Other Len:</dt>
          <dd pn="section-4.2-5.16">an unsigned 16-bit integer specifying the length of the Other
	  Data field in octets.</dd>
          <dt pn="section-4.2-5.17">Other Data:</dt>
          <dd pn="section-4.2-5.18">additional data relevant to the TSIG record. In responses, this
	  will be empty (i.e., Other Len will be zero) unless the content of
	  the Error field is BADTIME, in which case it will be a 48-bit
	  unsigned integer containing the server's current time as the number
	  of seconds since 00:00 on 1970-01-01 UTC, ignoring leap seconds (see
	  <xref target="time_check" format="default" sectionFormat="of" derivedContent="Section 5.2.3"/>). This document assigns
	  no meaning to its contents in requests.</dd>
        </dl>
      </section>
      <section anchor="mac_computation" numbered="true" toc="include" removeInRFC="false" pn="section-4.3">
        <name slugifiedName="name-mac-computation">MAC Computation</name>
        <t indent="0" pn="section-4.3-1">When generating or verifying the contents of a TSIG record,
        the data listed in the rest of this section are passed,
        in the order listed below, as input to MAC computation.  The
        data are passed in network byte order or wire format,
        as appropriate and are fed into the hashing function
        as a continuous octet sequence with no interfield separator or
        padding.</t>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-4.3.1">
          <name slugifiedName="name-request-mac">Request MAC</name>
          <t indent="0" pn="section-4.3.1-1">Only included in the computation of a MAC for a response message
          (or the first message in a multi-message response),
          the validated request MAC <bcp14>MUST</bcp14> be included in the MAC
          computation.  If the request MAC failed to validate, an unsigned
          error message <bcp14>MUST</bcp14> be returned instead (<xref target="on_error" format="default" sectionFormat="of" derivedContent="Section 5.3.2"/>).</t>
          <t indent="0" pn="section-4.3.1-2">The request's MAC, comprising the following fields, is digested in
          wire format:</t>
          <table anchor="mac-field" align="center" pn="table-1">
            <name slugifiedName="name-requests-mac">Request's MAC</name>
            <thead>
              <tr>
                <th align="left" colspan="1" rowspan="1">Field</th>
                <th align="left" colspan="1" rowspan="1">Type</th>
                <th align="left" colspan="1" rowspan="1">Description</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td align="left" colspan="1" rowspan="1">MAC Size</td>
                <td align="left" colspan="1" rowspan="1">Unsigned 16-bit integer</td>
                <td align="left" colspan="1" rowspan="1">in network byte order</td>
              </tr>
              <tr>
                <td align="left" colspan="1" rowspan="1">MAC Data</td>
                <td align="left" colspan="1" rowspan="1">octet sequence</td>
                <td align="left" colspan="1" rowspan="1">exactly as transmitted</td>
              </tr>
            </tbody>
          </table>
          <t indent="0" pn="section-4.3.1-4">Special considerations apply to the TSIG calculation for the
	  second and subsequent messages in a response that consists of multiple
	  DNS messages (e.g., a zone transfer). 
	 
	  These are described in <xref target="tcp" format="default" sectionFormat="of" derivedContent="Section 5.3.1"/>.</t>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-4.3.2">
          <name slugifiedName="name-dns-message">DNS Message</name>
          <t indent="0" pn="section-4.3.2-1">In the MAC computation, the whole/complete DNS message in
	  wire format is used.</t>
          <t indent="0" pn="section-4.3.2-2">When creating an outgoing message, the TSIG is based on
	  the message content before
the TSIG
   RR has been added to the additional section and before the
   DNS Message Header's ARCOUNT has been incremented to include
   the TSIG RR.</t>
          <t indent="0" pn="section-4.3.2-3">When verifying an incoming message, the TSIG is checked against
   the message after the TSIG RR has been removed, the ARCOUNT 
   decremented, and the message ID replaced by the original message
   ID from the TSIG if those IDs differ.  (This could happen, for
   example, when forwarding a dynamic update request.)</t>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-4.3.3">
          <name slugifiedName="name-tsig-variables">TSIG Variables</name>
          <t indent="0" pn="section-4.3.3-1">Also included in the digest is certain information present
          in the TSIG RR.  Adding this data provides further protection against an
          attempt to interfere with the message.</t>
          <table anchor="tisg-field-names" align="center" pn="table-2">
            <name slugifiedName="name-tsig-variables-2">TSIG Variables</name>
            <thead>
              <tr>
                <th align="left" colspan="1" rowspan="1">Source</th>
                <th align="left" colspan="1" rowspan="1">Field Name</th>
                <th align="left" colspan="1" rowspan="1">Notes</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td align="left" colspan="1" rowspan="1">TSIG RR</td>
                <td align="left" colspan="1" rowspan="1">NAME</td>
                <td align="left" colspan="1" rowspan="1">Key name, in canonical wire format</td>
              </tr>
              <tr>
                <td align="left" colspan="1" rowspan="1">TSIG RR</td>
                <td align="left" colspan="1" rowspan="1">CLASS</td>
                <td align="left" colspan="1" rowspan="1">
                  <bcp14>MUST</bcp14> be ANY</td>
              </tr>
              <tr>
                <td align="left" colspan="1" rowspan="1">TSIG RR</td>
                <td align="left" colspan="1" rowspan="1">TTL</td>
                <td align="left" colspan="1" rowspan="1">
                  <bcp14>MUST</bcp14> be 0</td>
              </tr>
              <tr>
                <td align="left" colspan="1" rowspan="1">TSIG RDATA</td>
                <td align="left" colspan="1" rowspan="1">Algorithm Name</td>
                <td align="left" colspan="1" rowspan="1">in canonical wire format</td>
              </tr>
              <tr>
                <td align="left" colspan="1" rowspan="1">TSIG RDATA</td>
                <td align="left" colspan="1" rowspan="1">Time Signed</td>
                <td align="left" colspan="1" rowspan="1">in network byte order</td>
              </tr>
              <tr>
                <td align="left" colspan="1" rowspan="1">TSIG RDATA</td>
                <td align="left" colspan="1" rowspan="1">Fudge</td>
                <td align="left" colspan="1" rowspan="1">in network byte order</td>
              </tr>
              <tr>
                <td align="left" colspan="1" rowspan="1">TSIG RDATA</td>
                <td align="left" colspan="1" rowspan="1">Error</td>
                <td align="left" colspan="1" rowspan="1">in network byte order</td>
              </tr>
              <tr>
                <td align="left" colspan="1" rowspan="1">TSIG RDATA</td>
                <td align="left" colspan="1" rowspan="1">Other Len</td>
                <td align="left" colspan="1" rowspan="1">in network byte order</td>
              </tr>
              <tr>
                <td align="left" colspan="1" rowspan="1">TSIG RDATA</td>
                <td align="left" colspan="1" rowspan="1">Other Data</td>
                <td align="left" colspan="1" rowspan="1">exactly as transmitted</td>
              </tr>
            </tbody>
          </table>
          <t indent="0" pn="section-4.3.3-3">The RR RDLENGTH and RDATA MAC Size are not included in the
          input to MAC computation, since they are not guaranteed to be
          knowable before the MAC is generated.</t>
          <t indent="0" pn="section-4.3.3-4">The Original ID field is not included in this section,
          as it has already been substituted for the message ID in
          the DNS header and hashed.</t>
          <t indent="0" pn="section-4.3.3-5">For each label type, there must be a defined "Canonical
          wire format" that specifies how to express a label in an
          unambiguous way.  For label type 00, this is defined in <xref target="RFC4034" sectionFormat="of" section="6.2" format="default" derivedLink="https://rfc-editor.org/rfc/rfc4034#section-6.2" derivedContent="RFC4034"/>.  The use of
	  label types other than 00 is not defined for this specification.</t>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-4.3.3.1">
            <name slugifiedName="name-time-values-used-in-tsig-ca">Time Values Used in TSIG Calculations</name>
            <t indent="0" pn="section-4.3.3.1-1">The data digested includes the two timer values in the
            TSIG header in order to defend against replay attacks.  If
            this were not done, an attacker could replay old messages
            but update the Time Signed and Fudge fields to make the
            message look new.  The two fields are collectively named "TSIG Timers", and
            for the purpose of MAC calculation, they are hashed in
            their wire format, in the following order: first
            Time Signed, then Fudge.</t>
          </section>
        </section>
      </section>
    </section>
    <section anchor="details" numbered="true" toc="include" removeInRFC="false" pn="section-5">
      <name slugifiedName="name-protocol-details">Protocol Details</name>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-5.1">
        <name slugifiedName="name-generation-of-tsig-on-reque">Generation of TSIG on Requests</name>
        <t indent="0" pn="section-5.1-1">Once the outgoing record has been constructed, the client performs
	the keyed hash (Hashed Message Authentication Code (HMAC))
	computation, appends a TSIG record with the 
	calculated MAC to the additional section (incrementing the
	ARCOUNT to reflect the additional RR), and transmits the request to
	the server.  This TSIG record <bcp14>MUST</bcp14> be the only TSIG RR
	in the message and <bcp14>MUST</bcp14> be the last record in the
	additional data section. The client <bcp14>MUST</bcp14> store the MAC
	and the key name from the request while awaiting an answer.</t>
        <t indent="0" pn="section-5.1-2">The digest components for a request are:</t>
        <ul empty="true" spacing="compact" bare="false" indent="3" pn="section-5.1-3">
          <li pn="section-5.1-3.1">DNS Message (request)</li>
          <li pn="section-5.1-3.2">TSIG Variables (request)</li>
        </ul>
      </section>
      <section anchor="request_processing" numbered="true" toc="include" removeInRFC="false" pn="section-5.2">
        <name slugifiedName="name-server-processing-of-reques">Server Processing of Request</name>
        <t indent="0" pn="section-5.2-1">If an incoming message contains a TSIG record, it <bcp14>MUST</bcp14>
        be the last record in the additional section.  Multiple
        TSIG records are not allowed.  If multiple TSIG records are detected
        or a TSIG record is present
        in any other position, the DNS message is dropped and a response
        with RCODE 1 (FORMERR) <bcp14>MUST</bcp14> be returned.  Upon receipt of
        a message with exactly one correctly placed TSIG RR, a copy of the
        TSIG RR is stored and the TSIG RR is removed from the DNS message
        and decremented out of the DNS message header's ARCOUNT.</t>
        <t indent="0" pn="section-5.2-2">If the TSIG RR cannot be interpreted, the server <bcp14>MUST</bcp14>
        regard the message as corrupt and return a FORMERR to the server.
        Otherwise, the server is <bcp14>REQUIRED</bcp14> to return a TSIG RR in
        the response.</t>
        <t indent="0" pn="section-5.2-3">To validate the received TSIG RR, the server <bcp14>MUST</bcp14> perform the
        following checks in the following order:</t>
        <ol type="1" spacing="normal" indent="adaptive" start="1" pn="section-5.2-4">
           <li pn="section-5.2-4.1" derivedCounter="1.">Check key</li>
          <li pn="section-5.2-4.2" derivedCounter="2.">Check MAC</li>
          <li pn="section-5.2-4.3" derivedCounter="3.">Check time values</li>
          <li pn="section-5.2-4.4" derivedCounter="4.">Check truncation policy</li>
        </ol>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-5.2.1">
          <name slugifiedName="name-key-check-and-error-handlin">Key Check and Error Handling</name>
          <t indent="0" pn="section-5.2.1-1">If a non-forwarding server does not recognize the key or
	  algorithm used by the client (or recognizes the algorithm but does
	  not implement it), the server <bcp14>MUST</bcp14> generate an error
	  response with RCODE 9 (NOTAUTH) and TSIG ERROR 17 (BADKEY). This
	  response <bcp14>MUST</bcp14> be unsigned as specified in <xref target="on_error" format="default" sectionFormat="of" derivedContent="Section 5.3.2"/>. The server
	  <bcp14>SHOULD</bcp14> log the error. (Special considerations apply
	  to forwarding servers; see <xref target="forwarding" format="default" sectionFormat="of" derivedContent="Section 5.5"/>.)</t>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-5.2.2">
          <name slugifiedName="name-mac-check-and-error-handlin">MAC Check and Error Handling</name>
          <t indent="0" pn="section-5.2.2-1">Using the information in the TSIG, the server <bcp14>MUST</bcp14> verify
          the MAC by doing its own calculation and comparing the result with
          the MAC received. If the MAC fails to
          verify, the server <bcp14>MUST</bcp14> generate an
          error response as specified in <xref target="on_error" format="default" sectionFormat="of" derivedContent="Section 5.3.2"/> with
          RCODE 9 (NOTAUTH) and TSIG ERROR 16 (BADSIG).  This response
          <bcp14>MUST</bcp14> be unsigned, as specified in <xref target="on_error" format="default" sectionFormat="of" derivedContent="Section 5.3.2"/>. 
          The server <bcp14>SHOULD</bcp14> log the error.</t>
          <section anchor="trunc" numbered="true" toc="exclude" removeInRFC="false" pn="section-5.2.2.1">
            <name slugifiedName="name-mac-truncation">MAC Truncation</name>
            <t indent="0" pn="section-5.2.2.1-1">When space is at a premium and the strength of the full
          length of a MAC is not needed, it is reasonable to truncate
          the keyed hash and use the truncated value for
          authentication.  HMAC SHA-1 truncated to 96 bits is an option
          available in several IETF protocols, including IPsec and TLS.
          However, while this option is kept for backwards compatibility,
          it may not provide a security level appropriate for all cases
          in the modern environment. In these cases, it is preferable to
          use a hashing algorithm such as SHA-256-128, SHA-384-192, or
          SHA-512-256 <xref target="RFC4868" format="default" sectionFormat="of" derivedContent="RFC4868"/>. </t>
            <t indent="0" pn="section-5.2.2.1-2">Processing of a truncated MAC follows these rules:</t>
            <dl spacing="normal" indent="3" newline="false" pn="section-5.2.2.1-3">
              <dt pn="section-5.2.2.1-3.1">If the MAC Size field is greater than the keyed hash output
		length:</dt>
              <dd pn="section-5.2.2.1-3.2">This case <bcp14>MUST NOT</bcp14> be generated and, if
		received, <bcp14>MUST</bcp14> cause the DNS message to be
		dropped and RCODE 1 (FORMERR) to be returned.</dd>
              <dt pn="section-5.2.2.1-3.3">If the MAC Size field equals the keyed hash output length:</dt>
              <dd pn="section-5.2.2.1-3.4">The
	      entire keyed hash output is present and used.</dd>
              <dt pn="section-5.2.2.1-3.5">If the MAC Size field is less than the larger of 10 (octets) and
		half the length of the hash function in use:</dt>
              <dd pn="section-5.2.2.1-3.6">With the
		exception of certain TSIG error messages described 
		in <xref target="on_error" format="default" sectionFormat="of" derivedContent="Section 5.3.2"/>, where it is
		permitted that the MAC Size be zero, this case <bcp14>MUST NOT</bcp14> be generated and, if received, <bcp14>MUST</bcp14>
		cause the DNS message to be dropped and RCODE 1 (FORMERR) to
		be returned.</dd>
              <dt pn="section-5.2.2.1-3.7">Otherwise:</dt>
              <dd pn="section-5.2.2.1-3.8">This is sent when the signer has truncated the keyed hash
		output to an allowable length, as described in <xref target="RFC2104" format="default" sectionFormat="of" derivedContent="RFC2104"/>, taking initial octets and
		discarding trailing octets.  TSIG truncation can only be to an
		integral number of octets.  On receipt of a DNS message with
		truncation thus indicated, the locally calculated MAC is
		similarly truncated, and only the truncated values are compared
		for authentication.  The request MAC used when calculating the
		TSIG MAC for a reply is the truncated request MAC.</dd>
            </dl>
          </section>
        </section>
        <section anchor="time_check" numbered="true" toc="include" removeInRFC="false" pn="section-5.2.3">
          <name slugifiedName="name-time-check-and-error-handli">Time Check and Error Handling</name>
          <t indent="0" pn="section-5.2.3-1">If the server time is outside the time interval specified
          by the request (which is the Time Signed value plus/minus
	  the Fudge value),
          the server <bcp14>MUST</bcp14> generate an error response with RCODE 9
          (NOTAUTH) and TSIG ERROR 18 (BADTIME).  The server <bcp14>SHOULD</bcp14>
          also cache the most recent Time Signed value in a message
          generated by a key and <bcp14>SHOULD</bcp14> return BADTIME if a message
          received later has an earlier Time Signed value.  A
          response indicating a BADTIME error <bcp14>MUST</bcp14> be signed by the
          same key as the request.  It <bcp14>MUST</bcp14> include the client's
          current time in the Time Signed field, the server's current
          time (an unsigned 48-bit integer) in the Other Data field, and 6 in the
          Other Len field.  This is done so that the client
          can verify a message with a BADTIME error without the
          verification failing due to another BADTIME error.  In
          addition, the Fudge field <bcp14>MUST</bcp14> be set to the fudge value
          received from the client.  The data signed is specified in
          <xref target="on_error" format="default" sectionFormat="of" derivedContent="Section 5.3.2"/>.  The server
	  <bcp14>SHOULD</bcp14> log the error.</t>
          <t indent="0" pn="section-5.2.3-2">Caching the most recent Time Signed value and rejecting
          requests with an earlier one could lead to valid messages
          being rejected if transit through the network led to UDP
          packets arriving in a different order to the one in which
          they were sent.  Implementations should be aware of
          this possibility and be prepared to deal with it, e.g., by
          retransmitting the rejected request with a new TSIG once
          outstanding requests have completed or the time given by their
          Time Signed value plus the Fudge value has passed.  If implementations
          do retry requests in these cases, a limit <bcp14>SHOULD</bcp14> be placed
          on the maximum number of retries.</t>
        </section>
        <section anchor="trunc_check" numbered="true" toc="include" removeInRFC="false" pn="section-5.2.4">
          <name slugifiedName="name-truncation-check-and-error-">Truncation Check and Error Handling</name>
          <t indent="0" pn="section-5.2.4-1">If a TSIG is received with truncation that is permitted
          per <xref target="trunc" format="default" sectionFormat="of" derivedContent="Section 5.2.2.1"/> but the MAC is too short
          for the local policy in force, an RCODE 9 (NOTAUTH) and TSIG
          ERROR 22 (BADTRUNC) <bcp14>MUST</bcp14> be returned. The server <bcp14>SHOULD</bcp14>
          log the error.</t>
        </section>
      </section>
      <section anchor="answers" numbered="true" toc="include" removeInRFC="false" pn="section-5.3">
        <name slugifiedName="name-generation-of-tsig-on-answe">Generation of TSIG on Answers</name>
        <t indent="0" pn="section-5.3-1">When a server has generated a response to a signed request,
        it signs the response using the same algorithm and key.  The
        server <bcp14>MUST NOT</bcp14> generate a signed response to a request if
        either the key is invalid (e.g., key name or algorithm name are unknown)
        or the MAC fails validation; see <xref target="on_error" format="default" sectionFormat="of" derivedContent="Section 5.3.2"/> for
        details of responding in these cases.</t>
        <t indent="0" pn="section-5.3-2">It also <bcp14>MUST NOT</bcp14> generate a signed
        response to an unsigned request, except in the case of a
        response to a client's unsigned TKEY request if the secret key
        is established on the server side after the server processed the
        client's request.  Signing responses to unsigned TKEY requests
        <bcp14>MUST</bcp14> be explicitly specified in the description of an individual
        secret key establishment algorithm <xref target="RFC3645" format="default" sectionFormat="of" derivedContent="RFC3645"/>.</t>
        <t indent="0" pn="section-5.3-3">The digest components used to generate a TSIG on a response are:</t>
        <ul empty="true" spacing="compact" bare="false" indent="3" pn="section-5.3-4">
          <li pn="section-5.3-4.1">Request MAC</li>
          <li pn="section-5.3-4.2">DNS Message (response)</li>
          <li pn="section-5.3-4.3">TSIG Variables (response)</li>
        </ul>
        <t indent="0" pn="section-5.3-5">(This calculation is different for the second and subsequent message
        in a multi-message answer; see below.)</t>
        <t indent="0" pn="section-5.3-6">If addition of the TSIG record will cause the message to be truncated,
        the server <bcp14>MUST</bcp14> alter the response so that a TSIG can be included.
        This response contains only the question and a TSIG
        record, has the TC bit set, and has an RCODE of 0 (NOERROR).
	At this point, the
        client <bcp14>SHOULD</bcp14> retry the request using TCP
        (as per <xref target="RFC1035" sectionFormat="of" section="4.2.2" format="default" derivedLink="https://rfc-editor.org/rfc/rfc1035#section-4.2.2" derivedContent="RFC1035"/>).</t>
        <section anchor="tcp" numbered="true" toc="include" removeInRFC="false" pn="section-5.3.1">
          <name slugifiedName="name-tsig-on-tcp-connections">TSIG on TCP Connections</name>
          <t indent="0" pn="section-5.3.1-1">A DNS TCP session, such as a zone transfer, can include multiple
        DNS messages. Using TSIG on such a connection can protect the
        connection from an attack and provide data integrity.  The TSIG
        <bcp14>MUST</bcp14> be included on all DNS messages in the response.  For backward
        compatibility, a client that receives DNS messages and verifies
        TSIG <bcp14>MUST</bcp14> accept up to 99 intermediary messages without a TSIG and
        <bcp14>MUST</bcp14> verify that both the first and last message contain a TSIG.</t>
          <t indent="0" pn="section-5.3.1-2">The first message is processed as a standard answer (see <xref target="answers" format="default" sectionFormat="of" derivedContent="Section 5.3"/>), but subsequent messages have
	  the following digest components:</t>
          <ul empty="true" spacing="compact" bare="false" indent="3" pn="section-5.3.1-3">
            <li pn="section-5.3.1-3.1">Prior MAC (running)</li>
            <li pn="section-5.3.1-3.2">DNS Messages (any unsigned messages since the last TSIG)</li>
            <li pn="section-5.3.1-3.3">TSIG Timers (current message)</li>
          </ul>
          <t indent="0" pn="section-5.3.1-4">The "Prior MAC" is the MAC from the TSIG attached to the last
        message containing a TSIG.  "DNS Messages" comprises the
        concatenation (in message order) of all messages after the last
        message that included a TSIG and includes the current message.
        "TSIG Timers" comprises the Time Signed and Fudge fields (in
        that order) pertaining to the message for which the TSIG was created;
        this means that the successive TSIG records in the stream will have
        non-decreasing Time Signed values. Note that only the
        timers are included in the second and subsequent messages, not all
        the TSIG variables.</t>
          <t indent="0" pn="section-5.3.1-5">This allows the client to rapidly detect when the session has
        been altered; at which point, it can close the connection and retry.
        If a client TSIG verification fails, the client <bcp14>MUST</bcp14> close the
        connection.  If the client does not receive TSIG records frequently
        enough (as specified above), it <bcp14>SHOULD</bcp14> assume the connection has
        been hijacked, and it <bcp14>SHOULD</bcp14> close the connection.  The
	client <bcp14>SHOULD</bcp14> 
        treat this the same way as they would any other interrupted transfer
        (although the exact behavior is not specified).</t>
        </section>
        <section anchor="on_error" numbered="true" toc="include" removeInRFC="false" pn="section-5.3.2">
          <name slugifiedName="name-generation-of-tsig-on-error">Generation of TSIG on Error Returns</name>
          <t indent="0" pn="section-5.3.2-1">When a server detects an error relating to the key or MAC in the
        incoming request, the
        server <bcp14>SHOULD</bcp14> send back an unsigned error message (MAC Size == 0
        and empty MAC). It <bcp14>MUST NOT</bcp14> send back a signed error message.</t>
          <t indent="0" pn="section-5.3.2-2">If an error is detected relating to the TSIG
        validity period or the MAC is too short for the local policy,
        the server <bcp14>SHOULD</bcp14> send back a signed error message.
        The digest components are:</t>
          <ul empty="true" spacing="compact" bare="false" indent="3" pn="section-5.3.2-3">
            <li pn="section-5.3.2-3.1">Request MAC (if the request MAC validated)</li>
            <li pn="section-5.3.2-3.2">DNS Message (response)</li>
            <li pn="section-5.3.2-3.3">TSIG Variables (response)</li>
          </ul>
          <t indent="0" pn="section-5.3.2-4">The reason that the request MAC is not included in this MAC in
        some cases is to make it possible for the client to verify the
        error.  If the error is not a TSIG error, the response <bcp14>MUST</bcp14> be
        generated as specified in <xref target="answers" format="default" sectionFormat="of" derivedContent="Section 5.3"/>.</t>
        </section>
      </section>
      <section anchor="client_proc_answer" numbered="true" toc="include" removeInRFC="false" pn="section-5.4">
        <name slugifiedName="name-client-processing-of-answer">Client Processing of Answer</name>
        <t indent="0" pn="section-5.4-1">When a client receives a response from a server and
	    expects to see a TSIG, it first checks if the TSIG RR is
	    present in the response.  If not, the response is treated as
	    having a format error and is discarded.</t>
        <t indent="0" pn="section-5.4-2">If the TSIG RR is present, the client performs the same checks as
        described in <xref target="request_processing" format="default" sectionFormat="of" derivedContent="Section 5.2"/>.  If the TSIG RR is
        unsigned as specified in <xref target="on_error" format="default" sectionFormat="of" derivedContent="Section 5.3.2"/> or does not
        validate, the message <bcp14>MUST</bcp14> be discarded unless the RCODE is 9 (NOAUTH).
        In this case, the client <bcp14>SHOULD</bcp14> attempt to verify the response as if it
        were a TSIG error, as described in the following subsections.</t>
        <t indent="0" pn="section-5.4-3">Regardless of the RCODE, a message containing a TSIG RR that is
        unsigned as specified in <xref target="on_error" format="default" sectionFormat="of" derivedContent="Section 5.3.2"/> or that fails
        verification <bcp14>SHOULD NOT</bcp14> be considered an acceptable response, as it
        may have been spoofed or manipulated. Instead, the
        client <bcp14>SHOULD</bcp14> log an error and continue to wait for a signed response
        until the request times out.</t>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-5.4.1">
          <name slugifiedName="name-key-error-handling">Key Error Handling</name>
          <t indent="0" pn="section-5.4.1-1">If an RCODE on a response is 9 (NOTAUTH), but the response
          TSIG validates and the TSIG key is recognized by the client
          but is different from that used on the request, then this is a
          key-related error.  The client <bcp14>MAY</bcp14> retry the request using the key
          specified by the server.  However, this should never occur, as
          a server <bcp14>MUST NOT</bcp14> sign a response with a different key to that
          used to sign the request.</t>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-5.4.2">
          <name slugifiedName="name-mac-error-handling">MAC Error Handling</name>
          <t indent="0" pn="section-5.4.2-1">If the response RCODE is 9 (NOTAUTH) and TSIG ERROR
          is 16 (BADSIG), this is a MAC-related error, and clients <bcp14>MAY</bcp14> retry
          the request with a new request ID, but it would be better
          to try a different shared key if one is available.  Clients
          <bcp14>SHOULD</bcp14> keep track of how many MAC errors are associated
          with each key.  Clients <bcp14>SHOULD</bcp14> log this event.</t>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-5.4.3">
          <name slugifiedName="name-time-error-handling">Time Error Handling</name>
          <t indent="0" pn="section-5.4.3-1">If the response RCODE is 9 (NOTAUTH) and the TSIG ERROR
          is 18 (BADTIME) or the current time does not fall in the
          range specified in the TSIG record, then this is a time-related
          error.  This is an indication that the client and server
          clocks are not synchronized.  In this case, the client
          <bcp14>SHOULD</bcp14> log the event.  DNS resolvers <bcp14>MUST NOT</bcp14> adjust any clocks in the client based on BADTIME errors,
	  but the server's time in the Other Data field <bcp14>SHOULD</bcp14>
	  be logged.</t>
        </section>
        <section anchor="trunc_err" numbered="true" toc="include" removeInRFC="false" pn="section-5.4.4">
          <name slugifiedName="name-truncation-error-handling">Truncation Error Handling</name>
          <t indent="0" pn="section-5.4.4-1">If the response RCODE is 9 (NOTAUTH) and the TSIG ERROR
          is 22 (BADTRUNC), then this is a truncation-related error. The client
	  <bcp14>MAY</bcp14> retry with a lesser truncation up to the full
	  HMAC output (no truncation), using the truncation used in the
	  response as a hint for what the server policy allowed (<xref target="trunc_pol" format="default" sectionFormat="of" derivedContent="Section 7"/>). Clients
	  <bcp14>SHOULD</bcp14> log this event.</t>
        </section>
      </section>
      <section anchor="forwarding" numbered="true" toc="include" removeInRFC="false" pn="section-5.5">
        <name slugifiedName="name-special-considerations-for-">Special Considerations for Forwarding Servers</name>
        <t indent="0" pn="section-5.5-1">A server acting as a forwarding server of a DNS message
        <bcp14>SHOULD</bcp14> check for the existence of a TSIG record.  If the name on
        the TSIG is not of a secret that the server shares with the
        originator, the server <bcp14>MUST</bcp14> forward the message unchanged
        including the TSIG.  If the name of the TSIG is of a key this
        server shares with the originator, it <bcp14>MUST</bcp14> process the TSIG.  If
        the TSIG passes all checks, the forwarding server <bcp14>MUST</bcp14>, if
        possible, include a TSIG of its own to the destination or the
        next forwarder. If no transaction security is available to the
        destination and the message is a query, and if the
        corresponding response has the AD flag (see <xref target="RFC4035" format="default" sectionFormat="of" derivedContent="RFC4035"/>) set, the forwarder <bcp14>MUST</bcp14> clear the
	AD flag 
        before adding the TSIG to the response and returning the result
        to the system from which it received the query.</t>
      </section>
    </section>
    <section anchor="algorithm_id" numbered="true" toc="include" removeInRFC="false" pn="section-6">
      <name slugifiedName="name-algorithms-and-identifiers">Algorithms and Identifiers</name>
      <t indent="0" pn="section-6-1">The only message digest algorithm specified in the first
      version of these specifications <xref target="RFC2845" format="default" sectionFormat="of" derivedContent="RFC2845"/> was
      "HMAC-MD5" (see <xref target="RFC1321" format="default" sectionFormat="of" derivedContent="RFC1321"/> and <xref target="RFC2104" format="default" sectionFormat="of" derivedContent="RFC2104"/>). 
      Although a review of its security some years ago <xref target="RFC6151" format="default" sectionFormat="of" derivedContent="RFC6151"/> concluded 
      that "it may not be urgent to remove HMAC-MD5 from the existing
      protocols", with the availability of more secure alternatives, the
      opportunity has been taken to make the implementation of this
      algorithm optional. </t>
      <t indent="0" pn="section-6-2"><xref target="RFC4635" format="default" sectionFormat="of" derivedContent="RFC4635"/> added mandatory support in
      TSIG for SHA-1 <xref target="FIPS180-4" format="default" sectionFormat="of" derivedContent="FIPS180-4"/> <xref target="RFC3174" format="default" sectionFormat="of" derivedContent="RFC3174"/>. SHA-1 collisions have been
      demonstrated <xref target="SHA1SHAMBLES" format="default" sectionFormat="of" derivedContent="SHA1SHAMBLES"/>, so the MD5
      security considerations described in <xref target="RFC6151" sectionFormat="of" section="2" format="default" derivedLink="https://rfc-editor.org/rfc/rfc6151#section-2" derivedContent="RFC6151"/> apply to SHA-1 in a similar manner.
      Although support for hmac-sha1 in TSIG is still mandatory for
      compatibility reasons, existing uses <bcp14>SHOULD</bcp14> be replaced
      with hmac-sha256 or other SHA-2 digest algorithms (<xref target="FIPS180-4" format="default" sectionFormat="of" derivedContent="FIPS180-4"/>, <xref target="RFC3874" format="default" sectionFormat="of" derivedContent="RFC3874"/>, <xref target="RFC6234" format="default" sectionFormat="of" derivedContent="RFC6234"/>).</t>
      <t indent="0" pn="section-6-3">Use of TSIG between two DNS agents is by mutual
      agreement.  That agreement can include the support of additional
      algorithms and criteria as to which algorithms and truncations are
      acceptable, subject to the restriction and guidelines in
      <xref target="trunc" format="default" sectionFormat="of" derivedContent="Section 5.2.2.1"/>.
      Key agreement can be by the TKEY mechanism <xref target="RFC2930" format="default" sectionFormat="of" derivedContent="RFC2930"/>
      or some other mutually agreeable method.</t>
      <t indent="0" pn="section-6-4">Implementations that support TSIG <bcp14>MUST</bcp14>
      also implement HMAC SHA1 and HMAC SHA256 and <bcp14>MAY</bcp14> implement
      gss-tsig and the other algorithms listed below.  SHA-1 truncated
      to 96 bits (12 octets) <bcp14>SHOULD</bcp14> be implemented.</t>
      <table anchor="allowed-algorithms" align="center" pn="table-3">
        <name slugifiedName="name-algorithms-for-implementati">Algorithms for Implementations Supporting TSIG</name>
        <thead>
          <tr>
            <th align="left" colspan="1" rowspan="1">Algorithm Name</th>
            <th align="left" colspan="1" rowspan="1">Implementation</th>
            <th align="left" colspan="1" rowspan="1">Use</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td align="left" colspan="1" rowspan="1">HMAC-MD5.SIG-ALG.REG.INT</td>
            <td align="left" colspan="1" rowspan="1">
              <bcp14>MAY</bcp14></td>
            <td align="left" colspan="1" rowspan="1">
              <bcp14>MUST NOT</bcp14></td>
          </tr>
          <tr>
            <td align="left" colspan="1" rowspan="1">gss-tsig</td>
            <td align="left" colspan="1" rowspan="1">
              <bcp14>MAY</bcp14></td>
            <td align="left" colspan="1" rowspan="1">
              <bcp14>MAY</bcp14></td>
          </tr>
          <tr>
            <td align="left" colspan="1" rowspan="1">hmac-sha1</td>
            <td align="left" colspan="1" rowspan="1">
              <bcp14>MUST</bcp14></td>
            <td align="left" colspan="1" rowspan="1">
              <bcp14>NOT RECOMMENDED</bcp14></td>
          </tr>
          <tr>
            <td align="left" colspan="1" rowspan="1">hmac-sha224</td>
            <td align="left" colspan="1" rowspan="1">
              <bcp14>MAY</bcp14></td>
            <td align="left" colspan="1" rowspan="1">
              <bcp14>MAY</bcp14></td>
          </tr>
          <tr>
            <td align="left" colspan="1" rowspan="1">hmac-sha256</td>
            <td align="left" colspan="1" rowspan="1">
              <bcp14>MUST</bcp14></td>
            <td align="left" colspan="1" rowspan="1">
              <bcp14>RECOMMENDED</bcp14></td>
          </tr>
          <tr>
            <td align="left" colspan="1" rowspan="1">hmac-sha256-128</td>
            <td align="left" colspan="1" rowspan="1">
              <bcp14>MAY</bcp14></td>
            <td align="left" colspan="1" rowspan="1">
              <bcp14>MAY</bcp14></td>
          </tr>
          <tr>
            <td align="left" colspan="1" rowspan="1">hmac-sha384</td>
            <td align="left" colspan="1" rowspan="1">
              <bcp14>MAY</bcp14></td>
            <td align="left" colspan="1" rowspan="1">
              <bcp14>MAY</bcp14></td>
          </tr>
          <tr>
            <td align="left" colspan="1" rowspan="1">hmac-sha384-192</td>
            <td align="left" colspan="1" rowspan="1">
              <bcp14>MAY</bcp14></td>
            <td align="left" colspan="1" rowspan="1">
              <bcp14>MAY</bcp14></td>
          </tr>
          <tr>
            <td align="left" colspan="1" rowspan="1">hmac-sha512</td>
            <td align="left" colspan="1" rowspan="1">
              <bcp14>MAY</bcp14></td>
            <td align="left" colspan="1" rowspan="1">
              <bcp14>MAY</bcp14></td>
          </tr>
          <tr>
            <td align="left" colspan="1" rowspan="1">hmac-sha512-256</td>
            <td align="left" colspan="1" rowspan="1">
              <bcp14>MAY</bcp14></td>
            <td align="left" colspan="1" rowspan="1">
              <bcp14>MAY</bcp14></td>
          </tr>
        </tbody>
      </table>
    </section>
    <section anchor="trunc_pol" numbered="true" toc="include" removeInRFC="false" pn="section-7">
      <name slugifiedName="name-tsig-truncation-policy">TSIG Truncation Policy</name>
      <t indent="0" pn="section-7-1">As noted above, two DNS agents (e.g., resolver and server) must
      mutually agree to use TSIG.
      Implicit in such an "agreement" are criteria as to acceptable keys,
      algorithms, and (with the extensions in this document) truncations.
      Local policies <bcp14>MAY</bcp14> require the rejection of TSIGs, even though
      they use an algorithm for which implementation is mandatory.</t>
      <t indent="0" pn="section-7-2">When a local policy permits acceptance of a TSIG with a particular
      algorithm and a particular non-zero amount of truncation, it <bcp14>SHOULD</bcp14>
      also permit the use of that algorithm with lesser truncation (a
      longer MAC) up to the full keyed hash output.</t>
      <t indent="0" pn="section-7-3">Regardless of a lower acceptable truncated MAC length specified by
      local policy, a reply <bcp14>SHOULD</bcp14> be sent with a MAC at least as long as
      that in the corresponding request. Note, if the request specified a MAC
      length longer than the keyed hash output, it will be rejected by
      processing rules (<xref target="trunc" format="default" sectionFormat="of" derivedContent="Section 5.2.2.1"/>, case 1).</t>
      <t indent="0" pn="section-7-4">Implementations permitting multiple acceptable algorithms and/or
      truncations <bcp14>SHOULD</bcp14> permit this list to be ordered by presumed
      strength and <bcp14>SHOULD</bcp14> allow different truncations for the same
      algorithm to be treated as separate entities in this list.  When so
      implemented, policies <bcp14>SHOULD</bcp14> accept a presumed stronger algorithm and
      truncation than the minimum strength required by the policy.</t>
    </section>
    <section numbered="true" toc="include" removeInRFC="false" pn="section-8">
      <name slugifiedName="name-shared-secrets">Shared Secrets</name>
      <t indent="0" pn="section-8-1">Secret keys are very sensitive information and all available
      steps should be taken to protect them on every host on which they
      are stored.  Generally, such hosts need to be physically protected.
      If they are multi-user machines, great care should be taken so that
      unprivileged users have no access to keying material.  Resolvers
      often run unprivileged, which means all users of a host would be
      able to see whatever configuration data are used by the resolver.</t>
      <t indent="0" pn="section-8-2">A name server usually runs privileged, which means its
      configuration data need not be visible to all users of the host.
      For this reason, a host that implements transaction-based
      authentication should probably be configured with a "stub
      resolver" and a local caching and forwarding name server.  This
      presents a special problem for <xref target="RFC2136" format="default" sectionFormat="of" derivedContent="RFC2136"/>, which
      otherwise depends on clients to communicate only with a zone's
      authoritative name servers.</t>
      <t indent="0" pn="section-8-3">Use of strong, random shared secrets is essential to the
      security of TSIG.  See <xref target="RFC4086" format="default" sectionFormat="of" derivedContent="RFC4086"/> for a discussion
      of this issue.  The secret <bcp14>SHOULD</bcp14> be at least as long as the keyed hash
      output <xref target="RFC2104" format="default" sectionFormat="of" derivedContent="RFC2104"/>.</t>
    </section>
    <section numbered="true" toc="include" removeInRFC="false" pn="section-9">
      <name slugifiedName="name-iana-considerations">IANA Considerations</name>
      <t indent="0" pn="section-9-1">IANA maintains a registry of algorithm names to be used as
      "Algorithm Names", as defined in <xref target="format" format="default" sectionFormat="of" derivedContent="Section 4.2"/> <xref target="IANA-TSIG" format="default" sectionFormat="of" derivedContent="IANA-TSIG"/>. Algorithm
      names are text strings encoded using the syntax of a domain name.  There
      is no structure to the names, and algorithm names are compared
      as if they were DNS names, i.e., comparison is case
      insensitive. Previous specifications (<xref target="RFC2845" format="default" sectionFormat="of" derivedContent="RFC2845"/> and <xref target="RFC4635" format="default" sectionFormat="of" derivedContent="RFC4635"/>)
      defined values for the HMAC-MD5 and some HMAC-SHA 
      algorithms. IANA has also registered "gss-tsig" as an identifier for TSIG
      authentication where the cryptographic operations are delegated to the
      Generic Security Service (GSS) <xref target="RFC3645" format="default" sectionFormat="of" derivedContent="RFC3645"/>.  This document
      adds to the allowed algorithms, and the registry has been updated with the
      names listed in <xref target="allowed-algorithms" format="default" sectionFormat="of" derivedContent="Table 3"/>.</t>
      <t indent="0" pn="section-9-2">New algorithms are assigned using
      the IETF Review policy defined in <xref target="RFC8126" format="default" sectionFormat="of" derivedContent="RFC8126"/>.
      The algorithm name
      HMAC-MD5.SIG-ALG.REG.INT looks like a fully qualified domain
      name for historical reasons;
      other algorithm names are simple, single-component names.</t>
      <t indent="0" pn="section-9-3">IANA maintains a registry of RCODEs (error codes) (see <xref target="IANA-RCODEs" format="default" sectionFormat="of" derivedContent="IANA-RCODEs"/>, including
      "TSIG Error values" to be used for "Error" values, as defined in
      <xref target="format" format="default" sectionFormat="of" derivedContent="Section 4.2"/>.  This document defines the RCODEs as
      described in <xref target="numbers" format="default" sectionFormat="of" derivedContent="Section 3"/>.  New error codes are assigned and
      specified as in <xref target="RFC6895" format="default" sectionFormat="of" derivedContent="RFC6895"/>.</t>
    </section>
    <section numbered="true" toc="include" removeInRFC="false" pn="section-10">
      <name slugifiedName="name-security-considerations">Security Considerations</name>
      <t indent="0" pn="section-10-1">The approach specified here is computationally much less
      expensive than the signatures specified in DNSSEC.  As long as
      the shared secret key is not compromised, strong authentication
      is provided between two DNS systems, e.g., for the last hop from
      a local name server to the user resolver or between primary and
      secondary name servers.</t>
      <t indent="0" pn="section-10-2">Recommendations for choosing and maintaining secret keys can be found
      in <xref target="RFC2104" format="default" sectionFormat="of" derivedContent="RFC2104"/>.  If the client host has been compromised,
      the server should suspend the use of all secrets known to that client.
      If possible, secrets should be stored in an encrypted form.  Secrets should
      never be transmitted in the clear over any network.  This document does
      not address the issue on how to distribute secrets except that it
      mentions the possibilities of manual configuration and the use of TKEY
      <xref target="RFC2930" format="default" sectionFormat="of" derivedContent="RFC2930"/>.  Secrets <bcp14>SHOULD NOT</bcp14> be shared by more than two 
      entities; any such additional sharing would allow any party knowing the
      key to impersonate any other such party to members of the group.</t>
      <t indent="0" pn="section-10-3">This mechanism does not authenticate source data, only its
      transmission between two parties who share some secret.  The
      original source data can come from a compromised zone master or
      can be corrupted during transit from an authentic zone master to
      some "caching forwarder".  However, if the server is faithfully
      performing the full DNSSEC security checks, then
      only security-checked data will be available to the client.</t>
      <t indent="0" pn="section-10-4">A Fudge value that is too large may leave the server open
      to replay attacks.  A Fudge value that is too small may cause
      failures if machines are not time synchronized or there are unexpected
      network delays.  The <bcp14>RECOMMENDED</bcp14> value in most situations is 300
      seconds.</t>
      <t indent="0" pn="section-10-5">To prevent cross-algorithm attacks, there <bcp14>SHOULD</bcp14> only be one
      algorithm associated with any given key name.</t>
      <t indent="0" pn="section-10-6">In several cases where errors are detected, an unsigned error
      message must be returned. This can allow for an attacker to spoof
      or manipulate these responses.  <xref target="client_proc_answer" format="default" sectionFormat="of" derivedContent="Section 5.4"/>
      recommends logging these as errors and continuing to wait for a
      signed response until the request times out.</t>
      <t indent="0" pn="section-10-7">Although the strength of an algorithm determines its security,
      there have been some arguments that mild truncation can
      strengthen a MAC by reducing the information available to an
      attacker.  However, excessive truncation clearly weakens authentication by
      reducing the number of bits an attacker has to try to break the
      authentication by brute force <xref target="RFC2104" format="default" sectionFormat="of" derivedContent="RFC2104"/>.</t>
      <t indent="0" pn="section-10-8">Significant progress has been made recently in cryptanalysis of hash
      functions of the types used here.  While the results so far should not
      affect HMAC, the stronger SHA-256 algorithm is being made mandatory as a
      precaution.</t>
      <t indent="0" pn="section-10-9">See also the Security Considerations section of <xref target="RFC2104" format="default" sectionFormat="of" derivedContent="RFC2104"/> from which the limits on truncation
      in this RFC were taken.</t>
      <section anchor="issuesfixed" numbered="true" toc="include" removeInRFC="false" pn="section-10.1">
        <name slugifiedName="name-issue-fixed-in-this-documen">Issue Fixed in This Document</name>
        <t indent="0" pn="section-10.1-1">When signing a DNS reply message using TSIG, the MAC
         computation uses the request message's MAC as an input to
         cryptographically relate the reply to the request.  The
         original TSIG specification <xref target="RFC2845" format="default" sectionFormat="of" derivedContent="RFC2845"/> required
         that the time values be checked before the request's MAC.  If
         the time was invalid, some implementations failed to carry out
         further checks and could use an invalid request MAC in the
         signed reply.</t>
        <t indent="0" pn="section-10.1-2">This document makes it mandatory that the request MAC
         is considered to be invalid until it has been validated;
         until then, any answer must be unsigned.  For this reason, the
         request MAC is now checked before the time values.</t>
      </section>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-10.2">
        <name slugifiedName="name-why-not-dnssec">Why Not DNSSEC?</name>
        <t indent="0" pn="section-10.2-1">DNS has been extended by DNSSEC
           (<xref target="RFC4033" format="default" sectionFormat="of" derivedContent="RFC4033"/>, <xref target="RFC4034" format="default" sectionFormat="of" derivedContent="RFC4034"/>, and 
           <xref target="RFC4035" format="default" sectionFormat="of" derivedContent="RFC4035"/>) to provide for data origin
           authentication, and public key distribution, all based on
           public key cryptography and public key based digital
           signatures.  To be practical, this form of security
           generally requires extensive local caching of keys and
           tracing of authentication through multiple keys and
           signatures to a pre-trusted locally configured key.</t>
        <t indent="0" pn="section-10.2-2">One difficulty with the DNSSEC scheme is that common DNS
           implementations include simple "stub" resolvers which do not
           have caches.  Such resolvers typically rely on a caching DNS
           server on another host.  It is impractical for these stub
           resolvers to perform general DNSSEC authentication and they
           would naturally depend on their caching DNS server to
           perform such services for them.  To do so securely requires
           secure communication of queries and responses.  DNSSEC
           provides public key transaction signatures to support this,
           but such signatures are very expensive computationally to
           generate.  In general, these require the same complex public
           key logic that is impractical for stubs.</t>
        <t indent="0" pn="section-10.2-3">A second area where use of straight DNSSEC public key based
	  mechanisms may be impractical is authenticating dynamic update <xref target="RFC2136" format="default" sectionFormat="of" derivedContent="RFC2136"/> requests. DNSSEC provides for
	  request signatures but with DNSSEC they, like transaction
	  signatures, require computationally expensive public key
	  cryptography and complex authentication logic. Secure Domain Name
	  System Dynamic Update (<xref target="RFC3007" format="default" sectionFormat="of" derivedContent="RFC3007"/>)
	  describes how different keys are used in dynamically updated
	  zones.</t>
      </section>
    </section>
  </middle>
  <back>
    <references pn="section-11">
      <name slugifiedName="name-references">References</name>
      <references pn="section-11.1">
        <name slugifiedName="name-normative-references">Normative References</name>
        <reference anchor="FIPS180-4" target="https://doi.org/10.6028/NIST.FIPS.180-4" quoteTitle="true" derivedAnchor="FIPS180-4">
          <front>
            <title>Secure Hash Standard (SHS)</title>
            <seriesInfo name="FIPS" value="PUB 180-4"/>
            <author>
              <organization showOnFrontPage="true">National Institute of Standards and Technology</organization>
            </author>
            <date month="August" year="2015"/>
          </front>
          <seriesInfo name="DOI" value="10.6028/NIST.FIPS.180-4"/>
        </reference>
        <reference anchor="RFC1034" target="https://www.rfc-editor.org/info/rfc1034" quoteTitle="true" derivedAnchor="RFC1034">
          <front>
            <title>Domain names - concepts and facilities</title>
            <author initials="P.V." surname="Mockapetris" fullname="P.V. Mockapetris">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="1987" month="November"/>
            <abstract>
              <t indent="0">This RFC is the revised basic definition of The Domain Name System.  It obsoletes RFC-882.  This memo describes the domain style names and their used for host address look up and electronic mail forwarding.  It discusses the clients and servers in the domain name system and the protocol used between them.</t>
            </abstract>
          </front>
          <seriesInfo name="STD" value="13"/>
          <seriesInfo name="RFC" value="1034"/>
          <seriesInfo name="DOI" value="10.17487/RFC1034"/>
        </reference>
        <reference anchor="RFC1035" target="https://www.rfc-editor.org/info/rfc1035" quoteTitle="true" derivedAnchor="RFC1035">
          <front>
            <title>Domain names - implementation and specification</title>
            <author initials="P.V." surname="Mockapetris" fullname="P.V. Mockapetris">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="1987" month="November"/>
            <abstract>
              <t indent="0">This RFC is the revised specification of the protocol and format used in the implementation of the Domain Name System.  It obsoletes RFC-883. This memo documents the details of the domain name client - server communication.</t>
            </abstract>
          </front>
          <seriesInfo name="STD" value="13"/>
          <seriesInfo name="RFC" value="1035"/>
          <seriesInfo name="DOI" value="10.17487/RFC1035"/>
        </reference>
        <reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119" quoteTitle="true" derivedAnchor="RFC2119">
          <front>
            <title>Key words for use in RFCs to Indicate Requirement Levels</title>
            <author initials="S." surname="Bradner" fullname="S. Bradner">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="1997" month="March"/>
            <abstract>
              <t indent="0">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="RFC2845" target="https://www.rfc-editor.org/info/rfc2845" quoteTitle="true" derivedAnchor="RFC2845">
          <front>
            <title>Secret Key Transaction Authentication for DNS (TSIG)</title>
            <author initials="P." surname="Vixie" fullname="P. Vixie">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="O." surname="Gudmundsson" fullname="O. Gudmundsson">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="D." surname="Eastlake 3rd" fullname="D. Eastlake 3rd">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="B." surname="Wellington" fullname="B. Wellington">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2000" month="May"/>
            <abstract>
              <t indent="0">This protocol allows for transaction level authentication using shared secrets and one way hashing.  It can be used to authenticate dynamic updates as coming from an approved client, or to authenticate responses as coming from an approved recursive name server.  [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="2845"/>
          <seriesInfo name="DOI" value="10.17487/RFC2845"/>
        </reference>
        <reference anchor="RFC3597" target="https://www.rfc-editor.org/info/rfc3597" quoteTitle="true" derivedAnchor="RFC3597">
          <front>
            <title>Handling of Unknown DNS Resource Record (RR) Types</title>
            <author initials="A." surname="Gustafsson" fullname="A. Gustafsson">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2003" month="September"/>
            <abstract>
              <t indent="0">Extending the Domain Name System (DNS) with new Resource Record (RR) types currently requires changes to name server software.  This document specifies the changes necessary to allow future DNS implementations to handle new RR types transparently.  [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="3597"/>
          <seriesInfo name="DOI" value="10.17487/RFC3597"/>
        </reference>
        <reference anchor="RFC4635" target="https://www.rfc-editor.org/info/rfc4635" quoteTitle="true" derivedAnchor="RFC4635">
          <front>
            <title>HMAC SHA (Hashed Message Authentication Code, Secure Hash Algorithm) TSIG Algorithm Identifiers</title>
            <author initials="D." surname="Eastlake 3rd" fullname="D. Eastlake 3rd">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2006" month="August"/>
            <abstract>
              <t indent="0">Use of the Domain Name System TSIG resource record requires specification of a cryptographic message authentication code. Currently, identifiers have been specified only for HMAC MD5 (Hashed Message Authentication Code, Message Digest 5) and GSS (Generic Security Service) TSIG algorithms.  This document standardizes identifiers and implementation requirements for additional HMAC SHA (Secure Hash Algorithm) TSIG algorithms and standardizes how to specify and handle the truncation of HMAC values in TSIG.  [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="4635"/>
          <seriesInfo name="DOI" value="10.17487/RFC4635"/>
        </reference>
        <reference anchor="RFC8174" target="https://www.rfc-editor.org/info/rfc8174" quoteTitle="true" derivedAnchor="RFC8174">
          <front>
            <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
            <author initials="B." surname="Leiba" fullname="B. Leiba">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2017" month="May"/>
            <abstract>
              <t indent="0">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>
      </references>
      <references pn="section-11.2">
        <name slugifiedName="name-informative-references">Informative References</name>
        <reference anchor="CVE-2017-11104" target="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-11104" quoteTitle="true" derivedAnchor="CVE-2017-11104">
          <front>
            <title>CVE-2017-11104: Improper TSIG validity period check can allow TSIG forgery</title>
            <author>
              <organization showOnFrontPage="true">Common Vulnerabilities and Exposures</organization>
            </author>
            <date month="June" year="2017"/>
          </front>
        </reference>
        <reference anchor="CVE-2017-3142" target="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-3142" quoteTitle="true" derivedAnchor="CVE-2017-3142">
          <front>
            <title>CVE-2017-3142: An error in TSIG authentication can permit unauthorized zone transfers</title>
            <author>
              <organization showOnFrontPage="true">Common Vulnerabilities and Exposures</organization>
            </author>
            <date month="June" year="2017"/>
          </front>
        </reference>
        <reference anchor="CVE-2017-3143" target="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-3143" quoteTitle="true" derivedAnchor="CVE-2017-3143">
          <front>
            <title>CVE-2017-3143: An error in TSIG authentication can permit unauthorized dynamic updates</title>
            <author>
              <organization showOnFrontPage="true">Common Vulnerabilities and Exposures</organization>
            </author>
            <date month="June" year="2017"/>
          </front>
        </reference>
        <reference anchor="IANA-RCODEs" target="https://www.iana.org/assignments/dns-parameters/" quoteTitle="true" derivedAnchor="IANA-RCODEs">
          <front>
            <title>DNS RCODEs</title>
            <author>
              <organization showOnFrontPage="true">IANA</organization>
            </author>
          </front>
        </reference>
        <reference anchor="IANA-TSIG" target="https://www.iana.org/assignments/tsig-algorithm-names/" quoteTitle="true" derivedAnchor="IANA-TSIG">
          <front>
            <title>TSIG Algorithm Names</title>
            <author>
              <organization showOnFrontPage="true">IANA</organization>
            </author>
          </front>
        </reference>
        <reference anchor="RFC1321" target="https://www.rfc-editor.org/info/rfc1321" quoteTitle="true" derivedAnchor="RFC1321">
          <front>
            <title>The MD5 Message-Digest Algorithm</title>
            <author initials="R." surname="Rivest" fullname="R. Rivest">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="1992" month="April"/>
            <abstract>
              <t indent="0">This document describes the MD5 message-digest algorithm. The algorithm takes as input a message of arbitrary length and produces as output a 128-bit "fingerprint" or "message digest" of the input.  This memo provides information for the Internet community.  It does not specify an Internet standard.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="1321"/>
          <seriesInfo name="DOI" value="10.17487/RFC1321"/>
        </reference>
        <reference anchor="RFC2104" target="https://www.rfc-editor.org/info/rfc2104" quoteTitle="true" derivedAnchor="RFC2104">
          <front>
            <title>HMAC: Keyed-Hashing for Message Authentication</title>
            <author initials="H." surname="Krawczyk" fullname="H. Krawczyk">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="M." surname="Bellare" fullname="M. Bellare">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="R." surname="Canetti" fullname="R. Canetti">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="1997" month="February"/>
            <abstract>
              <t indent="0">This document describes HMAC, a mechanism for message authentication using cryptographic hash functions. HMAC can be used with any iterative cryptographic hash function, e.g., MD5, SHA-1, in combination with a secret shared key.  The cryptographic strength of HMAC depends on the properties of the underlying hash function.  This memo provides information for the Internet community.  This memo does not specify an Internet standard of any kind</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="2104"/>
          <seriesInfo name="DOI" value="10.17487/RFC2104"/>
        </reference>
        <reference anchor="RFC2136" target="https://www.rfc-editor.org/info/rfc2136" quoteTitle="true" derivedAnchor="RFC2136">
          <front>
            <title>Dynamic Updates in the Domain Name System (DNS UPDATE)</title>
            <author initials="P." surname="Vixie" fullname="P. Vixie" role="editor">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="S." surname="Thomson" fullname="S. Thomson">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="Y." surname="Rekhter" fullname="Y. Rekhter">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="J." surname="Bound" fullname="J. Bound">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="1997" month="April"/>
            <abstract>
              <t indent="0">Using this specification of the UPDATE opcode, it is possible to add or delete RRs or RRsets from a specified zone.  Prerequisites are specified separately from update operations, and can specify a dependency upon either the previous existence or nonexistence of an RRset, or the existence of a single RR.  [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="2136"/>
          <seriesInfo name="DOI" value="10.17487/RFC2136"/>
        </reference>
        <reference anchor="RFC2930" target="https://www.rfc-editor.org/info/rfc2930" quoteTitle="true" derivedAnchor="RFC2930">
          <front>
            <title>Secret Key Establishment for DNS (TKEY RR)</title>
            <author initials="D." surname="Eastlake 3rd" fullname="D. Eastlake 3rd">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2000" month="September"/>
            <abstract>
              <t indent="0">This document describes a Transaction Key (TKEY) RR that can be used in a number of different modes to establish shared secret keys between a DNS resolver and server.  [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="2930"/>
          <seriesInfo name="DOI" value="10.17487/RFC2930"/>
        </reference>
        <reference anchor="RFC3007" target="https://www.rfc-editor.org/info/rfc3007" quoteTitle="true" derivedAnchor="RFC3007">
          <front>
            <title>Secure Domain Name System (DNS) Dynamic Update</title>
            <author initials="B." surname="Wellington" fullname="B. Wellington">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2000" month="November"/>
            <abstract>
              <t indent="0">This document proposes a method for performing secure Domain Name System (DNS) dynamic updates.  [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="3007"/>
          <seriesInfo name="DOI" value="10.17487/RFC3007"/>
        </reference>
        <reference anchor="RFC3174" target="https://www.rfc-editor.org/info/rfc3174" quoteTitle="true" derivedAnchor="RFC3174">
          <front>
            <title>US Secure Hash Algorithm 1 (SHA1)</title>
            <author initials="D." surname="Eastlake 3rd" fullname="D. Eastlake 3rd">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="P." surname="Jones" fullname="P. Jones">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2001" month="September"/>
            <abstract>
              <t indent="0">The purpose of this document is to make the SHA-1 (Secure Hash Algorithm 1) hash algorithm conveniently available to the Internet community. This memo provides information for the Internet community.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="3174"/>
          <seriesInfo name="DOI" value="10.17487/RFC3174"/>
        </reference>
        <reference anchor="RFC3645" target="https://www.rfc-editor.org/info/rfc3645" quoteTitle="true" derivedAnchor="RFC3645">
          <front>
            <title>Generic Security Service Algorithm for Secret Key Transaction Authentication for DNS (GSS-TSIG)</title>
            <author initials="S." surname="Kwan" fullname="S. Kwan">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="P." surname="Garg" fullname="P. Garg">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="J." surname="Gilroy" fullname="J. Gilroy">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="L." surname="Esibov" fullname="L. Esibov">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="J." surname="Westhead" fullname="J. Westhead">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="R." surname="Hall" fullname="R. Hall">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2003" month="October"/>
            <abstract>
              <t indent="0">The Secret Key Transaction Authentication for DNS (TSIG) protocol provides transaction level authentication for DNS.  TSIG is extensible through the definition of new algorithms.  This document specifies an algorithm based on the Generic Security Service Application Program Interface (GSS-API) (RFC2743).  This document updates RFC 2845.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="3645"/>
          <seriesInfo name="DOI" value="10.17487/RFC3645"/>
        </reference>
        <reference anchor="RFC3874" target="https://www.rfc-editor.org/info/rfc3874" quoteTitle="true" derivedAnchor="RFC3874">
          <front>
            <title>A 224-bit One-way Hash Function: SHA-224</title>
            <author initials="R." surname="Housley" fullname="R. Housley">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2004" month="September"/>
            <abstract>
              <t indent="0">This document specifies a 224-bit one-way hash function, called SHA-224.  SHA-224 is based on SHA-256, but it uses a different initial value and the result is truncated to 224 bits.  This memo provides information for the Internet community.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="3874"/>
          <seriesInfo name="DOI" value="10.17487/RFC3874"/>
        </reference>
        <reference anchor="RFC4033" target="https://www.rfc-editor.org/info/rfc4033" quoteTitle="true" derivedAnchor="RFC4033">
          <front>
            <title>DNS Security Introduction and Requirements</title>
            <author initials="R." surname="Arends" fullname="R. Arends">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="R." surname="Austein" fullname="R. Austein">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="M." surname="Larson" fullname="M. Larson">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="D." surname="Massey" fullname="D. Massey">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="S." surname="Rose" fullname="S. Rose">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2005" month="March"/>
            <abstract>
              <t indent="0">The Domain Name System Security Extensions (DNSSEC) add data origin authentication and data integrity to the Domain Name System.  This document introduces these extensions and describes their capabilities and limitations.  This document also discusses the services that the DNS security extensions do and do not provide.  Last, this document describes the interrelationships between the documents that collectively describe DNSSEC.  [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="4033"/>
          <seriesInfo name="DOI" value="10.17487/RFC4033"/>
        </reference>
        <reference anchor="RFC4034" target="https://www.rfc-editor.org/info/rfc4034" quoteTitle="true" derivedAnchor="RFC4034">
          <front>
            <title>Resource Records for the DNS Security Extensions</title>
            <author initials="R." surname="Arends" fullname="R. Arends">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="R." surname="Austein" fullname="R. Austein">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="M." surname="Larson" fullname="M. Larson">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="D." surname="Massey" fullname="D. Massey">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="S." surname="Rose" fullname="S. Rose">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2005" month="March"/>
            <abstract>
              <t indent="0">This document is part of a family of documents that describe the DNS Security Extensions (DNSSEC).  The DNS Security Extensions are a collection of resource records and protocol modifications that provide source authentication for the DNS.  This document defines the public key (DNSKEY), delegation signer (DS), resource record digital signature (RRSIG), and authenticated denial of existence (NSEC) resource records.  The purpose and format of each resource record is described in detail, and an example of each resource record is given. </t>
              <t indent="0"> This document obsoletes RFC 2535 and incorporates changes from all updates to RFC 2535.  [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="4034"/>
          <seriesInfo name="DOI" value="10.17487/RFC4034"/>
        </reference>
        <reference anchor="RFC4035" target="https://www.rfc-editor.org/info/rfc4035" quoteTitle="true" derivedAnchor="RFC4035">
          <front>
            <title>Protocol Modifications for the DNS Security Extensions</title>
            <author initials="R." surname="Arends" fullname="R. Arends">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="R." surname="Austein" fullname="R. Austein">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="M." surname="Larson" fullname="M. Larson">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="D." surname="Massey" fullname="D. Massey">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="S." surname="Rose" fullname="S. Rose">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2005" month="March"/>
            <abstract>
              <t indent="0">This document is part of a family of documents that describe the DNS Security Extensions (DNSSEC).  The DNS Security Extensions are a collection of new resource records and protocol modifications that add data origin authentication and data integrity to the DNS.  This document describes the DNSSEC protocol modifications.  This document defines the concept of a signed zone, along with the requirements for serving and resolving by using DNSSEC.  These techniques allow a security-aware resolver to authenticate both DNS resource records and authoritative DNS error indications. </t>
              <t indent="0"> This document obsoletes RFC 2535 and incorporates changes from all updates to RFC 2535.  [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="4035"/>
          <seriesInfo name="DOI" value="10.17487/RFC4035"/>
        </reference>
        <reference anchor="RFC4086" target="https://www.rfc-editor.org/info/rfc4086" quoteTitle="true" derivedAnchor="RFC4086">
          <front>
            <title>Randomness Requirements for Security</title>
            <author initials="D." surname="Eastlake 3rd" fullname="D. Eastlake 3rd">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="J." surname="Schiller" fullname="J. Schiller">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="S." surname="Crocker" fullname="S. Crocker">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2005" month="June"/>
            <abstract>
              <t indent="0">Security systems are built on strong cryptographic algorithms that foil pattern analysis attempts.  However, the security of these systems is dependent on generating secret quantities for passwords, cryptographic keys, and similar quantities.  The use of pseudo-random processes to generate secret quantities can result in pseudo-security. A sophisticated attacker may find it easier to reproduce the environment that produced the secret quantities and to search the resulting small set of possibilities than to locate the quantities in the whole of the potential number space.</t>
              <t indent="0">Choosing random quantities to foil a resourceful and motivated adversary is surprisingly difficult.  This document points out many pitfalls in using poor entropy sources or traditional pseudo-random number generation techniques for generating such quantities.  It recommends the use of truly random hardware techniques and shows that the existing hardware on many systems can be used for this purpose. It provides suggestions to ameliorate the problem when a hardware solution is not available, and it gives examples of how large such quantities need to be for some applications.  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="106"/>
          <seriesInfo name="RFC" value="4086"/>
          <seriesInfo name="DOI" value="10.17487/RFC4086"/>
        </reference>
        <reference anchor="RFC4868" target="https://www.rfc-editor.org/info/rfc4868" quoteTitle="true" derivedAnchor="RFC4868">
          <front>
            <title>Using HMAC-SHA-256, HMAC-SHA-384, and HMAC-SHA-512 with IPsec</title>
            <author initials="S." surname="Kelly" fullname="S. Kelly">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="S." surname="Frankel" fullname="S. Frankel">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2007" month="May"/>
            <abstract>
              <t indent="0">This specification describes the use of Hashed Message Authentication Mode (HMAC) in conjunction with the SHA-256, SHA-384, and SHA-512 algorithms in IPsec.  These algorithms may be used as the basis for data origin authentication and integrity verification mechanisms for the Authentication Header (AH), Encapsulating Security Payload (ESP), Internet Key Exchange Protocol (IKE), and IKEv2 protocols, and also as Pseudo-Random Functions (PRFs) for IKE and IKEv2.  Truncated output lengths are specified for the authentication-related variants, with the corresponding algorithms designated as HMAC-SHA-256-128, HMAC-SHA-384-192, and HMAC-SHA-512-256.  The PRF variants are not truncated, and are called PRF-HMAC-SHA-256, PRF-HMAC-SHA-384, and PRF-HMAC-SHA-512.  [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="4868"/>
          <seriesInfo name="DOI" value="10.17487/RFC4868"/>
        </reference>
        <reference anchor="RFC6151" target="https://www.rfc-editor.org/info/rfc6151" quoteTitle="true" derivedAnchor="RFC6151">
          <front>
            <title>Updated Security Considerations for the MD5 Message-Digest and the HMAC-MD5 Algorithms</title>
            <author initials="S." surname="Turner" fullname="S. Turner">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="L." surname="Chen" fullname="L. Chen">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2011" month="March"/>
            <abstract>
              <t indent="0">This document updates the security considerations for the MD5 message digest algorithm.  It also updates the security considerations for HMAC-MD5.  This document is not an Internet Standards Track  specification; it is published for informational purposes.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="6151"/>
          <seriesInfo name="DOI" value="10.17487/RFC6151"/>
        </reference>
        <reference anchor="RFC6234" target="https://www.rfc-editor.org/info/rfc6234" quoteTitle="true" derivedAnchor="RFC6234">
          <front>
            <title>US Secure Hash Algorithms (SHA and SHA-based HMAC and HKDF)</title>
            <author initials="D." surname="Eastlake 3rd" fullname="D. Eastlake 3rd">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="T." surname="Hansen" fullname="T. Hansen">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2011" month="May"/>
            <abstract>
              <t indent="0">Federal Information Processing Standard, FIPS</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="6234"/>
          <seriesInfo name="DOI" value="10.17487/RFC6234"/>
        </reference>
        <reference anchor="RFC6895" target="https://www.rfc-editor.org/info/rfc6895" quoteTitle="true" derivedAnchor="RFC6895">
          <front>
            <title>Domain Name System (DNS) IANA Considerations</title>
            <author initials="D." surname="Eastlake 3rd" fullname="D. Eastlake 3rd">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2013" month="April"/>
            <abstract>
              <t indent="0">This document specifies Internet Assigned Numbers Authority (IANA) parameter assignment considerations for the allocation of Domain Name System (DNS) resource record types, CLASSes, operation codes, error codes, DNS protocol message header bits, and AFSDB resource record subtypes.  It obsoletes RFC 6195 and updates RFCs 1183, 2845, 2930, and 3597.</t>
            </abstract>
          </front>
          <seriesInfo name="BCP" value="42"/>
          <seriesInfo name="RFC" value="6895"/>
          <seriesInfo name="DOI" value="10.17487/RFC6895"/>
        </reference>
        <reference anchor="RFC7696" target="https://www.rfc-editor.org/info/rfc7696" quoteTitle="true" derivedAnchor="RFC7696">
          <front>
            <title>Guidelines for Cryptographic Algorithm Agility and Selecting Mandatory-to-Implement Algorithms</title>
            <author initials="R." surname="Housley" fullname="R. Housley">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2015" month="November"/>
            <abstract>
              <t indent="0">Many IETF protocols use cryptographic algorithms to provide confidentiality, integrity, authentication, or digital signature.  Communicating peers must support a common set of cryptographic algorithms for these mechanisms to work properly.  This memo provides guidelines to ensure that protocols have the ability to migrate from one mandatory-to-implement algorithm suite to another over time.</t>
            </abstract>
          </front>
          <seriesInfo name="BCP" value="201"/>
          <seriesInfo name="RFC" value="7696"/>
          <seriesInfo name="DOI" value="10.17487/RFC7696"/>
        </reference>
        <reference anchor="RFC8126" target="https://www.rfc-editor.org/info/rfc8126" quoteTitle="true" derivedAnchor="RFC8126">
          <front>
            <title>Guidelines for Writing an IANA Considerations Section in RFCs</title>
            <author initials="M." surname="Cotton" fullname="M. Cotton">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="B." surname="Leiba" fullname="B. Leiba">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="T." surname="Narten" fullname="T. Narten">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2017" month="June"/>
            <abstract>
              <t indent="0">Many protocols make use of points of extensibility that use constants to identify various protocol parameters.  To ensure that the values in these fields do not have conflicting uses and to promote interoperability, their allocations are often coordinated by a central record keeper.  For IETF protocols, that role is filled by the Internet Assigned Numbers Authority (IANA).</t>
              <t indent="0">To make assignments in a given registry prudently, guidance describing the conditions under which new values should be assigned, as well as when and how modifications to existing values can be made, is needed.  This document defines a framework for the documentation of these guidelines by specification authors, in order to assure that the provided guidance for the IANA Considerations is clear and addresses the various issues that are likely in the operation of a registry.</t>
              <t indent="0">This is the third edition of this document; it obsoletes RFC 5226.</t>
            </abstract>
          </front>
          <seriesInfo name="BCP" value="26"/>
          <seriesInfo name="RFC" value="8126"/>
          <seriesInfo name="DOI" value="10.17487/RFC8126"/>
        </reference>
        <reference anchor="SHA1SHAMBLES" target="https://eprint.iacr.org/2020/014.pdf" quoteTitle="true" derivedAnchor="SHA1SHAMBLES">
          <front>
            <title>SHA-1 is a Shambles</title>
            <author surname="Leurent" initials="G" fullname="Gaetan Leurent"/>
            <author surname="Peyrin" initials="T" fullname="Thomas Peyrin"/>
            <date month="January" year="2020"/>
          </front>
        </reference>
      </references>
    </references>
    <section anchor="acks" numbered="false" toc="include" removeInRFC="false" pn="section-appendix.a">
      <name slugifiedName="name-acknowledgements">Acknowledgements</name>
      <t indent="0" pn="section-appendix.a-1">The security problem addressed by this document was reported by
      <contact fullname="Clément Berthaux"/> from Synacktiv.</t>
      <t indent="0" pn="section-appendix.a-2"><contact fullname="Peter van Dijk"/>, <contact fullname="Benno       Overeinder"/>, <contact fullname="Willem Toroop"/>, <contact fullname="Ondrej Sury"/>, <contact fullname="Mukund Sivaraman"/>, and
      <contact fullname="Ralph Dolmans"/> participated in the discussions that
      prompted this document.  <contact fullname="Mukund Sivaraman"/>,
      <contact fullname="Martin Hoffman"/>, and <contact fullname="Tony       Finch"/> made extremely helpful suggestions concerning the structure and
      wording of the updated document.</t>
      <t indent="0" pn="section-appendix.a-3">Stephen Morris would like to thank Internet Systems Consortium for its
  support of his participation in the creation of this document.</t>
    </section>
    <section anchor="authors-addresses" numbered="false" removeInRFC="false" toc="include" pn="section-appendix.b">
      <name slugifiedName="name-authors-addresses">Authors' Addresses</name>
      <author fullname="Francis Dupont" initials="F" surname="Dupont">
        <organization abbrev="ISC" showOnFrontPage="true">Internet Systems Consortium, Inc.</organization>
        <address>
          <postal>
            <street>PO Box 360</street>
            <city>Newmarket</city>
            <region>NH</region>
            <code>03857</code>
            <country>United States of America</country>
          </postal>
          <email>Francis.Dupont@fdupont.fr</email>
        </address>
      </author>
      <author fullname="Stephen Morris" initials="S" surname="Morris">
        <organization abbrev="Unaffiliated" showOnFrontPage="true">Unaffiliated</organization>
        <address>
          <postal>
            <country>United Kingdom</country>
          </postal>
          <email>sa.morris8@gmail.com</email>
        </address>
      </author>
      <author fullname="Paul Vixie" initials="P" surname="Vixie">
        <organization abbrev="Farsight" showOnFrontPage="true">Farsight Security Inc</organization>
        <address>
          <postal>
            <street>177 Bovet Road</street>
            <extaddr>Suite 180</extaddr>
            <city>San Mateo</city>
            <region>CA</region>
            <code>94402</code>
            <country>United States of America</country>
          </postal>
          <email>paul@redbarn.org</email>
        </address>
      </author>
      <author fullname="Donald E. Eastlake 3rd" initials="D" surname="Eastlake 3rd">
        <organization abbrev="Futurewei" showOnFrontPage="true">Futurewei Technologies</organization>
        <address>
          <postal>
            <street>2386 Panoramic Circle</street>
            <city>Apopka</city>
            <region>FL</region>
            <code>32703</code>
            <country>United States of America</country>
          </postal>
          <email>d3e3e3@gmail.com</email>
        </address>
      </author>
      <author fullname="Olafur Gudmundsson" initials="O" surname="Gudmundsson">
        <organization abbrev="Cloudflare" showOnFrontPage="true">Cloudflare</organization>
        <address>
          <postal>
            <street/>
            <city/>
            <region/>
            <code/>
            <country>United States of America</country>
          </postal>
          <email>olafur+ietf@cloudflare.com</email>
        </address>
      </author>
      <author fullname="Brian Wellington" initials="B" surname="Wellington">
        <organization abbrev="Akamai" showOnFrontPage="true">Akamai</organization>
        <address>
          <postal>
            <street/>
            <country>United States of America</country>
          </postal>
          <email>bwelling@akamai.com</email>
        </address>
      </author>
    </section>
  </back>
</rfc>
