<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>

<rfc xmlns:xi="http://www.w3.org/2001/XInclude" 
submissionType="independent" 
docName="draft-cuiling-dnsop-sm2-alg-15" 
number="9563"
category="info" 
ipr="trust200902" 
obsoletes="" 
updates="" 
xml:lang="en" 
tocInclude="true"
symRefs="true" 
sortRefs="true" 
version="3">

	<front>
    <title abbrev="SM2 Digital Signature Algorithm for DNSSEC">SM2 Digital Signature Algorithm for DNSSEC</title>
    <seriesInfo name="RFC" value="9563"/>
    <author initials="C." surname="Zhang" fullname="Cuiling Zhang">
      <organization>CNNIC</organization>
      <address>
        <postal>
          <street>No.4 South 4th Street, Zhongguancun</street>
          <city>Beijing</city><code>100190</code>
          <country>China</country>
        </postal>
        <email>zhangcuiling@cnnic.cn</email>
      </address>
    </author>
    <author initials="Y." surname="Liu" fullname="Yukun Liu">
      <organization>CNNIC</organization>
      <address>
        <postal>
          <street>No.4 South 4th Street, Zhongguancun</street>
          <city>Beijing</city><code>100190</code>
          <country>China</country>
        </postal>
        <email>liuyukun@cnnic.cn</email>
      </address>
    </author>
    <author initials="F." surname="Leng" fullname="Feng Leng">
      <organization>CNNIC</organization>
      <address>
        <postal>
          <street>No.4 South 4th Street, Zhongguancun</street>
          <city>Beijing</city><code>100190</code>
          <country>China</country>
        </postal>
        <email>lengfeng@cnnic.cn</email>
      </address>
    </author>
    <author initials="Q." surname="Zhao" fullname="Qi Zhao">
      <organization>CNNIC</organization>
      <address>
        <postal>
          <street>No.4 South 4th Street, Zhongguancun</street>
          <city>Beijing</city><code>100190</code>
          <country>China</country>
        </postal>
        <email>zhaoqi@cnnic.cn</email>
      </address>
    </author>
    <author initials="Z." surname="He" fullname="Zheng He">
      <organization>CNNIC</organization>
      <address>
        <postal>
          <street>No.4 South 4th Street, Zhongguancun</street>
          <city>Beijing</city><code>100190</code>
          <country>China</country>
        </postal>
        <email>hezh@cnnic.cn</email>
      </address>
    </author>

    <date year="2024" month="December"/>

    <abstract>
      <t>
   This document specifies the use of the SM2 digital signature algorithm
   and SM3 hash algorithm for DNS Security (DNSSEC).</t>
      <t>
   This document is an Independent Submission to the RFC series and does
   not have consensus of the IETF community.</t>
    </abstract>
  </front>
  <middle>
    <section anchor="sect-1" numbered="true" toc="default">
      <name>Introduction</name>
      <t>
   DNSSEC is broadly defined in <xref target="RFC4033" format="default"/>, <xref target="RFC4034" format="default"/>, and <xref target="RFC4035" format="default"/>.
   It uses cryptographic keys and digital signatures to provide
   authentication of DNS data. DNSSEC signature algorithms are
   registered in the DNSSEC algorithm numbers registry <xref target="IANA" format="default"/>.</t>
      <t>
   This document defines the DNSKEY and RRSIG resource records (RRs)
   of new signing algorithms: SM2 uses elliptic curves over 256-bit
   prime fields with SM3 hash algorithm. (A description of SM2 can be found in GM/T 0003.2-2012 <xref target="GMT-0003.2" format="default"/> or ISO/IEC14888-3:2018 
   <xref target="ISO-IEC14888-3_2018" format="default"/>, and a description of SM3
   can be found in GM/T 0004-2012 <xref target="GMT-0004" format="default"/> or
   ISO/IEC10118-3:2018 <xref target="ISO-IEC10118-3_2018" format="default"/>.) This document also
   defines the DS RR for the SM3 one-way hash algorithm. In the signing
   algorithm defined in this document, the size of the key for the
   elliptic curve is matched with the size of the output of the hash
   algorithm. Both are 256 bits.</t>

<t>
Many implementations may not support SM2 signatures and SM3 digests.  <xref target="RFC6840" sectionFormat="of" section="5.2"/> specifies handling of answers in such cases.</t>

<t>
Caution: This specification is not a standard and does not have IETF community consensus. It makes use of cryptographic algorithms that are national standards for China, as well as ISO/IEC standards (ISO/IEC 14888:3-2018 <xref target="ISO-IEC14888-3_2018"/> and ISO/IEC 10118:3-2018 <xref target="ISO-IEC10118-3_2018" format="default"/>). Neither the IETF nor the IRTF has analyzed that algorithm for suitability for any given application, and it may contain either intended or unintended weaknesses.
</t>
      <t>
    The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>",
    "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL NOT</bcp14>",
    "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>",
    "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
    "<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are to be
    interpreted as described in BCP&nbsp;14 <xref target="RFC2119"/> <xref
    target="RFC8174"/> when, and only when, they appear in all capitals, as
    shown here.</t>
    </section>
    <section anchor="sect-2" numbered="true" toc="default">
      <name>SM3 DS Records</name>
      <t>
   The implementation of SM3 in DNSSEC follows the implementation of
   SHA-256 as specified in <xref target="RFC4509" format="default"/> except that the underlying
   algorithm is SM3 with digest type code 6.</t>
      <t>
   The generation of an SM3 hash value is described in Section 5 of
   <xref target="GMT-0004" format="default"/> and generates a 256-bit hash value.</t>
    </section>
    <section anchor="sect-3" numbered="true" toc="default">
      <name>SM2 Parameters</name>
      <t>
   Verifying SM2 signatures requires agreement between the signer and
   the verifier on the parameters used. The SM2 digital signature algorithm
   has been added to <xref target="ISO-IEC14888-3_2018"/>. The parameters of the
   curve used in this profile are as follows:</t>
      <artwork name="" type="" align="left" alt=""><![CDATA[
p  = FFFFFFFE FFFFFFFF FFFFFFFF FFFFFFFF 
     FFFFFFFF 00000000 FFFFFFFF FFFFFFFF
a  = FFFFFFFE FFFFFFFF FFFFFFFF FFFFFFFF
     FFFFFFFF 00000000 FFFFFFFF FFFFFFFC
b  = 28E9FA9E 9D9F5E34 4D5A9E4B CF6509A7
     F39789F5 15AB8F92 DDBCBD41 4D940E93
xG = 32C4AE2C 1F198119 5F990446 6A39C994
     8FE30BBF F2660BE1 715A4589 334C74C7
yG = BC3736A2 F4F6779C 59BDCEE3 6B692153
     D0A9877C C62A4740 02DF32E5 2139F0A0
n  = FFFFFFFE FFFFFFFF FFFFFFFF FFFFFFFF
     7203DF6B 21C6052B 53BBF409 39D54123
]]></artwork>
    </section>
    <section anchor="sect-4" numbered="true" toc="default">
      <name>DNSKEY and RRSIG Resource Records for SM2</name>
      <section anchor="sect-4.1" numbered="true" toc="default">
        <name>DNSKEY Resource Records</name>
        <t>
   SM2 public keys consist of a single value, called "P".  In DNSSEC
   keys, P is a string of 64 octets that represents the uncompressed
   form of a curve point, "x | y".  (Conversion of a point to an octet
   string is described in Section 4.2.8 of <xref target="GMT-0003.1" format="default"/>.)</t>
      </section>
      <section anchor="sect-4.2" numbered="true" toc="default">
        <name>RRSIG Resource Records</name>
        <t>
   The SM2 signature is the combination of two non-negative integers,
   called "r" and "s". The two integers, each of which is formatted as
   a simple octet string, are combined into a single longer octet string
   for DNSSEC as the concatenation "r | s". (Conversion of the integers
   to bit strings is described in Section 4.2.1 of <xref target="GMT-0003.1" format="default"/>.)
   Each integer <bcp14>MUST</bcp14> be encoded as 32 octets.</t>
        <t>
   Process details are described in Section 6 of <xref target="GMT-0003.2" format="default"/>.</t>
        <t>
   The algorithm number associated with the DNSKEY and RRSIG resource records
   is 17, which is described in
   the IANA Considerations section.</t>

        <t>
   Conformant implementations that create records to be put into the DNS <bcp14>MAY</bcp14>
   implement signing and verification for the SM2 digital signature algorithm. Conformant
   DNSSEC verifiers <bcp14>MAY</bcp14> implement verification for the above algorithm.</t>
      </section>
    </section>
    <section anchor="sect-5" numbered="true" toc="default">
      <name>Support for NSEC3 Denial of Existence</name>
      <t>
   This document does not define algorithm aliases mentioned in <xref target="RFC5155" format="default"/>.</t>
      <t>
   A DNSSEC validator that implements the signing algorithms defined in this
   document <bcp14>MUST</bcp14> be able to validate negative answers in the form of both NSEC
   and NSEC3 with hash algorithm SHA-1, as defined in <xref target="RFC5155" format="default"/>. An authoritative
   server that does not implement NSEC3 <bcp14>MAY</bcp14> still serve zones that use the
   signing algorithms defined in this document with NSEC denial of existence.</t>
      <t>
   If using NSEC3, the iterations <bcp14>MUST</bcp14> be 0 and salt <bcp14>MUST</bcp14> be an empty string
   as recommended in <xref target="RFC9276" sectionFormat="of" section="3.1"/>.</t>
    </section>
    <section anchor="sect-6" numbered="true" toc="default">
      <name>Example</name>
      <t>
   The following is an example of SM2 keys and signatures in DNS zone file format,
   including DNSKEY RR, NSEC3PARAM RR, NSEC3 RR with RRSIG RRs, and DS RR.</t>

      <sourcecode type="dns-rr"><![CDATA[
Private-key-format: v1.3
Algorithm: 17 (SM2SM3)
PrivateKey: V24tjJgXxp2ykscKRZdT+iuR5J1xRQN+FKoQACmo9fA=

example. 3600 IN DS 27215 17 6 (
   86671f82dd872e4ee73647a95dff7fd0af599ff8a43f fa26c9a2593091653c0e
   )

example. 3600  IN   DNSKEY  256 3 17 (
    7EQ32PTAp+1ac6R9Ze2nfB8pPc2OJqkHSjug
    ALr4SuD9awuQxhfw7wMpiXv7JK4/VwwTrCxJ
    wu+qUuDsgoBK4w==
    ) ; ZSK; alg = SM2SM3 ; key id = 65042
example. 3600  IN   RRSIG   DNSKEY 17 1 3600 (
    20230901000000 20220901000000 65042 example.
    lF2eq49e62Nn4aT5x8ZI6PdRSTPHPDixZdyl
    lM6GWu4lkRWkpTgWLE4lQK/+qHdNS4DdTd36
    Jsuu0FSO5k48Qg== )

example. 0  IN   NSEC3PARAM 1 0 10 AABBCCDD
example. 0  IN   RRSIG    NSEC3PARAM 17 1 0 (
       20230901000000 20220901000000 65042 example.
       aqntwEYEJzkVb8SNuJLwdx7f+vivv5IUIeAj )

62KP1QB93KRGR6LM7SEVPJVNG90BLUE8.example. 3600 IN NSEC3  1 1 10
    AABBCCDD (
    GTGVQIILTSSJ8FFO9J6DC8PRTFAEA8G2 NS SOA RRSIG DNSKEY NSEC3PARAM )

62KP1QB93KRGR6LM7SEVPJVNG90BLUE8.example. 3600 IN RRSIG  NSEC3 17 2
    3600 (
    20230901000000 20220901000000 65042 example.
    FOWLegTgFkFY9vCOo4kHwjEvZ+IL1NMl4s9V
    hVyPOwokd5uOLKeXTP19HIeEtW73WcJ9XNe/ ie/knp7Edo/hxw== )
]]></sourcecode>

      <t>
<xref target="Example_Program" format="default"/> is an example program based on dnspython and gmssl,
   which supplies key generating, zone signing, zone validating, and DS RR
   generating functions for convenience.</t>
    </section>
    <section anchor="sect-7" numbered="true" toc="default">
      <name>IANA Considerations</name>
      <t>
IANA has registered the following in the "Digest Algorithms" registry within the "DNSSEC Delegation Signer (DS) Resource Record (RR) Type Digest Algorithms" registry group. </t>
<table anchor="tab1">  
  <thead>
    <tr>
      <th>Value</th>    
      <th>Digest Type</th>
      <th>Status</th>
      <th>Reference</th>
    </tr>
  </thead>
  <tbody>          
    <tr>
      <td>6</td>
      <td>SM3</td>
      <td>OPTIONAL</td>
      <td>This document</td>
    </tr>
  </tbody>
</table>

      <t>
IANA has registered the following in the "DNS Security Algorithm Numbers" registry within the "Domain Name System Security (DNSSEC) Algorithm Numbers" registry group.    </t>

<table anchor="tab2">
  <thead>
    <tr>
      <th>Number</th>    
      <th>Description</th>
      <th>Mnemonic</th>
      <th>Zone Signing</th>
      <th>Trans. Sec.</th>
      <th>Reference</th>
    </tr>
  </thead>
  <tbody>         
    <tr>
      <td>17</td>
      <td>SM2 signing algorithm with SM3 hashing algorithm</td>
      <td>SM2SM3</td>
      <td>Y</td>
      <td>*</td>
      <td>This document</td>
    </tr>
  </tbody>
</table>
      <t>
   * There has been no determination of standardization of the use of this
   algorithm with Transaction Security.</t>
    </section>
    <section anchor="sect-8" numbered="true" toc="default">
      <name>Security Considerations</name>
      <t>
   The security strength of SM2 depends on the size of the key. A longer
   key provides stronger security strength. The security of ECC-based
   algorithms is influenced by the curve it uses, too.</t>
      <t>
   Like any cryptographic algorithm, it may come to pass that a weakness
   is found in either SM2 or SM3. In this case, the proper remediation is
   crypto-agility. In the case of DNSSEC, the appropriate approach would
   be to regenerate appropriate DS, DNSKEY, RRSIG, and NSEC3 records.
   Care <bcp14>MUST</bcp14> be taken in this situation to permit appropriate rollovers,
   taking into account record caching. See <xref target="RFC7583" format="default"/> for details. A suitable replacement algorithm should be both widely
   implemented and not known to have weaknesses.</t>
      <t>
   The security considerations listed in <xref target="RFC4509" format="default"/> apply here as well.</t>
    </section>
  </middle>
  <back>

    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>

	<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
	<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
	<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4033.xml"/>
	<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4034.xml"/>
	<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4035.xml"/>

        <reference anchor="IANA" target="https://www.iana.org/assignments/dns-sec-alg-numbers">
          <front>
            <title>DNS Security Algorithm Numbers</title>
            <author>
              <organization>IANA</organization>
            </author>
            <date/>
          </front>
        </reference>

	<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4509.xml"/>
	<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.5155.xml"/>

	<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6840.xml"/>
	<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9276.xml"/>
	<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7583.xml"/>

        <reference anchor="GMT-0003.2">
          <front>
            <title>SM2 Public Key Cryptographic Algorithms Based on Elliptic Curves Part 2: Digital Signature Algorithm
</title>
            <author>
              <organization>Cryptography Standardization Technical Committee of China</organization>
            </author>
            <date month="March" year="2012"/>
          </front>
          <seriesInfo name="GM/T" value="0003.2-2012"/>
<refcontent>[In Chinese]</refcontent>
<annotation> English translation available at: <eref target="http://www.gmbz.org.cn/upload/2024-11-18/1731899583359013934.pdf"/></annotation>
        </reference>

        <reference anchor="ISO-IEC14888-3_2018">
          <front>
            <title>IT Security techniques -- Digital signatures with appendix -- Part 3: Discrete logarithm based mechanisms</title>
            <author>
              <organization>ISO/IEC</organization>
            </author>
            <date month="November" year="2018"/>
          </front>
          <seriesInfo name="ISO/IEC" value="14888-3:2018"/>
        </reference>

        <reference anchor="GMT-0004">
          <front>
            <title>SM3 Cryptographic Hash Algorithm</title>
            <author>
              <organization>Cryptography Standardization Technical Committee of China</organization>
            </author>
            <date month="March" year="2012"/>
          </front>
          <seriesInfo name="GM/T" value="0004-2012"/>
<refcontent>[In Chinese]</refcontent>
<annotation>English translation available at: <eref target="http://www.gmbz.org.cn/upload/2024-11-18/1731899426565012428.pdf"/>. </annotation> 
        </reference>


	<reference anchor="GMT-0003.1">
          <front>
            <title>SM2 Public Key Cryptographic Algorithms Based on Elliptic Curves Part 1: General</title>
            <author>
              <organization>Cryptography Standardization Technical Committee of China</organization>
            </author>
            <date month="March" year="2012"/>
          </front>
          <seriesInfo name="GM/T" value="0003.1-2012"/>
<refcontent>[In Chinese]</refcontent>
	<annotation>English translation available at: <eref target="http://www.gmbz.org.cn/upload/2024-11-18/1731899501687024253.pdf"/></annotation>
        </reference>

        <reference anchor="ISO-IEC10118-3_2018">
          <front>
            <title>IT Security techniques -- Hash-functions -- Part 3: Dedicated hash-functions</title>
            <author>
              <organization>ISO/IEC</organization>
            </author>
            <date month="October" year="2018"/>
          </front>
          <seriesInfo name="ISO/IEC" value="10118-3:2018"/>
        </reference>

      </references>

      <references>
        <name>Informative References</name>

        <reference anchor="Example_Program" target="https://github.com/scooct/dnssec_sm2sm3">
          <front>
            <title>sign and validate dnssec signature with sm2sm3 algorithm</title>
            <author/>
            <date month="April" year="2023"/>
          </front>
<refcontent>commit 6f98c17 </refcontent>
        </reference>

      </references>
    </references>

  </back>
</rfc>
