<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">

<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="3"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>

<rfc category="info"
     docName="draft-dang-webauthn-sm2-00"
     ipr="trust200902">
  <front>
    <title>Using SM2 with JOSE and COSE</title>

     <author initials="F" surname="Dang" fullname="Fan Dang">
      <organization>Tsinghua University</organization>
      <address>
        <postal>
          <street></street>
          <city>Beijing</city>
          <region></region>
          <code>100084</code>
          <country>China</country>
        </postal>
        <email>dangfan@tsinghua.edu.cn</email>
      </address>
    </author>

    <date year="2021"/>

    <area>Security</area>
    <workgroup>WebAuthn Working Group</workgroup>

    <keyword>Cryptography</keyword>
    <keyword>Digital Signature</keyword>
    <keyword>Internet-Draft</keyword>

    <abstract>
     <t>This specification defines algorithm encodings and representations
     enabling the ISO/IEC 14888-3:2018 elliptic curve "SM2" to be used for
     JSON Object Signing and Encryption (JOSE)
     and CBOR Object Signing and Encryption (COSE) messages.</t>
    </abstract>
  </front>

  <middle>
    <section anchor="Introduction" title="Introduction">
      <t>
	This specification defines algorithm encodings and representations enabling the
	ISO/IEC 14888-3:2018 elliptic curve "SM2" <xref target="ISO14888-3"/> to be used for
	JSON Object Signing and Encryption (JOSE) <xref target="RFC7515"/> and
	CBOR Object Signing and Encryption (COSE) <xref target="RFC8152"/> messages.
	The elliptic curve and associated algorithm are registered in
	appropriate IANA JOSE and COSE registries.
      </t>

      <section anchor="rnc" title="Requirements Notation and Conventions">
        <t>
	  The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
	  "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
	  "OPTIONAL" in this document are to be interpreted as described in
	  BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/> when, and
	  only when, they appear in all capitals, as shown here.
	</t>
      </section>
    </section>

    <section title="JOSE and COSE SM2 Curve Key Representations" anchor="curve">
      <t>
	The ISO/IEC 14888-3:2018 elliptic curve "SM2" <xref target="ISO14888-3"/> is represented in
	a JSON Web Key (JWK) <xref target="RFC7517"/> using these values:
      </t>
      <t>
	<?rfc subcompact="yes"?>
	<list style="symbols">  
	  <t><spanx style="verb">kty</spanx>: <spanx style="verb">EC</spanx></t>
	  <t><spanx style="verb">crv</spanx>: <spanx style="verb">SM2</spanx></t>
	</list>
	<?rfc subcompact="no"?>
      </t>
      <t>
	plus <spanx style="verb">x</spanx> and <spanx style="verb">y</spanx> values
	to represent the curve point for the key.
	Other optional values such as <spanx style="verb">alg</spanx> MAY also be present.
      </t>
      <t>
	It is represented in a COSE_Key <xref target ="RFC8152"/> using these values:
      </t>
      <t>
	<?rfc subcompact="yes"?>
	<list style="symbols">  
	  <t><spanx style="verb">kty</spanx> (1): <spanx style="verb">EC2</spanx> (2)</t>
	  <t><spanx style="verb">crv</spanx> (-1): <spanx style="verb">SM2</spanx> (TBD - requested assignment 9)</t>
	</list>
	<?rfc subcompact="no"?>
      </t>
      <t>
	plus <spanx style="verb">x</spanx> (-2) and <spanx style="verb">y</spanx> (-3) values
	to represent the curve point for the key.
	Other optional values such as <spanx style="verb">alg</spanx> (3) MAY also be present.
      </t>
    </section>

    <section title="ECDSA Signature with SM2 Curve" anchor="ECDSA">
      <t>
	The ECDSA signature algorithm is defined in <xref target="ISO14888-3"/>.
	Implementations need to check that the key type is <spanx style="verb">EC</spanx> for JOSE or
	<spanx style="verb">EC2</spanx> (2) for COSE when creating or verifying a signature.
      </t>
      <t>
	The ECDSA algorithm specified in this document is:
      </t>
      <texttable anchor="ec-algs" title="ECDSA Algorithm Values" suppress-title="false" align="center" style="full">
	<ttcol align="left">JOSE Alg Name</ttcol>
	<ttcol align="left">COSE Alg Value</ttcol>
	<ttcol align="left">Description</ttcol>

	<c>SM2</c>
	<c>TBD (requested assignment -48)</c>
	<c>ECDSA w/ SM2 Curve</c>

      </texttable>
    </section>

    <section anchor="IANA" title="IANA Considerations">

      <section anchor="jose-curve-registration" title="JSON Web Key Elliptic Curve Registration">
	<t>
	  This section registers the following value in the
	  IANA "JSON Web Key Elliptic Curve" registry <xref target="IANA.JOSE.Curves"/>.
	</t>
	<t>
	  <?rfc subcompact="yes"?>
	  <list style='symbols'>
	    <t>
	      Curve Name: curveSM2
	    </t>
	    <t>
	      Curve Description: SM2 Curve
	    </t>
	    <t>
	      JOSE Implementation Requirements: Optional
	    </t>
	    <t>
	      Change Controller: IESG
	    </t>
	    <t>
	      Specification Document(s): <xref target="curve"/> of [[ this specification ]]
	    </t>
	  </list>
	</t>
	<?rfc subcompact="no"?>
      </section>

      <section anchor="jose-algorithm-registration" title="JOSE Algorithm Registration">
        <t>
	  This section registers the following value in the
	  IANA "JSON Web Signature and Encryption Algorithms" registry <xref target="IANA.JOSE.Algorithms"/>.
	</t>
	<t>
	  <?rfc subcompact="yes"?>
	  <list style='symbols'>
	    <t>
	      Algorithm Name: SM2
	    </t>
	    <t>
	      Algorithm Description: ECDSA w/ SM2 Curve
	    </t>
	    <t>
	      Algorithm Usage Locations: alg
	    </t>
	    <t>
	      JOSE Implementation Requirements: Optional
	    </t>
	    <t>
	      Change Controller: IESG
	    </t>
	    <t>
	      Reference: <xref target="ECDSA"/> of [[ this specification ]]
	    </t>
	    <t>
	      Algorithm Analysis Document(s): <xref target="ISO14888-3"/>
	    </t>
	  </list>
	</t>
	<?rfc subcompact="no"?>
      </section>

      <section anchor="cose-curve-registration" title="COSE Elliptic Curves Registration">
	<t>
	  This section registers the following value in the
	  IANA "COSE Elliptic Curves" registry <xref target="IANA.COSE.Curves"/>.
	</t>
	<t>
	  <?rfc subcompact="yes"?>
	  <list style='symbols'>
	    <t>
	      Name: curveSM2
	    </t>
	    <t>
	      Value: TBD (requested assignment 9)
	    </t>
	    <t>
	      Key Type: EC2
	    </t>
	    <t>
	      Description: SM2 Curve
	    </t>
	    <t>
	      Change Controller: IESG
	    </t>
	    <t>
	      Reference: <xref target="curve"/> of [[ this specification ]]
	    </t>
	    <t>
	      Recommended: Yes
	    </t>
	  </list>
	</t>
	<?rfc subcompact="no"?>
      </section>

      <section anchor="cose-algorithm-registration" title="COSE Algorithm Registration">
        <t>
	  This section registers the following value in the
	  IANA "COSE Algorithms" registry <xref target="IANA.COSE.Algorithms"/>.
	</t>
	<t>
	  <?rfc subcompact="yes"?>
	  <list style='symbols'>
	    <t>
	      Name: SM2
	    </t>
	    <t>
	      Value: TBD (requested assignment -48)
	    </t>
	    <t>
	      Description: ECDSA w/ SM2 Curve
	    </t>
	    <t>
	      Reference: <xref target="ECDSA"/> of this document
	    </t>
	    <t>
	      Recommended: Yes
	    </t>
	  </list>
	</t>
	<?rfc subcompact="no"?>
      </section>

    </section>

    <section anchor="Security" title="Security Considerations">
      <t>
	The procedures and security considerations described in the
	<xref target="ISO14888-3"/>
	specifications apply to implementations of this specification.
      </t>
    </section>
  </middle>

  <back>
   <references title="Normative References">

      <?rfc include="reference.RFC.2119.xml"?>
      <?rfc include="reference.RFC.7515.xml"?>
      <?rfc include="reference.RFC.7517.xml"?>
      <?rfc include="reference.RFC.8152.xml"?>
      <?rfc include="reference.RFC.8174.xml"?>

      <reference anchor="ISO14888-3">
        <front>
          <title>IT Security techniques - Digital signatures with appendix - Part 3: Discrete logarithm based mechanisms</title>
          <author>
            <organization>International Organization for Standardization</organization>
          </author>
          <date month="November" year="2018" />
        </front>
      </reference>

    </references>

    <references title="Informative References">

      <reference anchor="IANA.JOSE.Algorithms" target="https://www.iana.org/assignments/jose/jose.xhtml#web-signature-encryption-algorithms">
        <front>
          <title>JSON Web Signature and Encryption Algorithms</title>
          <author>
            <organization>IANA</organization>
          </author>
	  <date/>
        </front>
      </reference>

      <reference anchor="IANA.JOSE.Curves" target="https://www.iana.org/assignments/jose/jose.xhtml#web-key-elliptic-curve">
        <front>
          <title>JSON Web Key Elliptic Curve</title>
          <author>
            <organization>IANA</organization>
          </author>
	  <date/>
        </front>
      </reference>

      <reference anchor="IANA.COSE.Algorithms" target="https://www.iana.org/assignments/cose/cose.xhtml#algorithms">
        <front>
          <title>COSE Algorithms</title>
          <author>
            <organization>IANA</organization>
          </author>
	  <date/>
        </front>
      </reference>

      <reference anchor="IANA.COSE.Curves" target="https://www.iana.org/assignments/cose/cose.xhtml#elliptic-curves">
        <front>
          <title>COSE Elliptic Curves</title>
          <author>
            <organization>IANA</organization>
          </author>
	  <date/>
        </front>
      </reference>

    </references>

    <section title="Document History" anchor="History">
      <t>
        [[ to be removed by the RFC Editor before publication as an RFC ]]
      </t>

      <t>
        -00
        <list style='symbols'>
          <t>
	    Initial version.
          </t>
        </list>
      </t>

    </section>

  </back>

</rfc>
