Bug 25618: Revised namedCurve extensibility for ECDH
authorMark Watson <watsonm@netflix.com>
Wed, 15 Oct 2014 16:07:19 -0700
changeset 251 1499886c4da3
parent 250 160514715d11
child 252 10c01a8e208e
Bug 25618: Revised namedCurve extensibility for ECDH
spec/Overview-WebCryptoAPI.xml
spec/Overview.html
--- a/spec/Overview-WebCryptoAPI.xml	Wed Oct 15 15:53:42 2014 -0700
+++ b/spec/Overview-WebCryptoAPI.xml	Wed Oct 15 16:07:19 2014 -0700
@@ -10290,34 +10290,6 @@
                   <p>Let <var>keyData</var> be the key data to be imported.</p>
                 </li>
                 <li>
-                  <p>
-                    Perform any <a href="#dfn-ecdh-extended-import-steps">key import steps</a>
-                    defined by <a href="#dfn-applicable-specifications">other applicable
-                    specifications</a>, passing <var>keyData</var> and obtaining <var>result</var>.
-                    <dl class="switch">
-                      <dt>
-                        If <var>result</var> is a <a href="#dfn-CryptoKey">CryptoKey</a>
-                        object
-                      </dt>
-                      <dd>
-                        <p>
-                          Return <var>result</var>.
-                        </p>
-                      </dd>
-                      <dt>
-                        If <var>result</var> is an error with a name that is not
-                        <a href="#dfn-NotSupportedError"><code>NotSupportedError</code></a>
-                      </dt>
-                      <dd>
-                        <p>
-                          <a href="#concept-return-an-error">Return an error</a> with the same name
-                          as <var>result</var>.
-                        </p>
-                      </dd>
-                    </dl>
-                  </p>
-                </li>
-                <li>
                   <dl class="switch">
                     <dt>If <var>format</var> is <code>"spki"</code>:</dt>
                     <dd>
@@ -10414,10 +10386,26 @@
                             </dd>
                             <dt>Otherwise:</dt>
                             <dd>
-                              <p>
-                                <a href="#concept-return-an-error">Return an error</a> named
-                                <a href="#dfn-DataError"><code>DataError</code></a>.
-                              </p>
+                              <ol>
+                                <li>
+                                  <p>
+                                    Perform any <a href="#dfn-ecdh-extended-import-steps">key
+                                    import steps</a> defined by
+                                    <a href="#dfn-applicable-specifications">other applicable
+                                    specifications</a>, passing <var>format</var>, <var>spki</var>
+                                    and obtaining <var>namedCurve</var>.
+                                  </p>
+                                </li>
+                                <li>
+                                  <p>
+                                    If an error occured or there are no
+                                    <a href="#dfn-applicable-specifications">applicable
+                                    specifications</a>,
+                                    <a href="#concept-return-an-error">return an error</a> named
+                                    <a href="#dfn-DataError"><code>DataError</code></a>.
+                                  </p>
+                                </li>
+                              </ol>
                             </dd>
                           </dl>
                         </li>
@@ -10598,10 +10586,26 @@
                             </dd>
                             <dt>Otherwise:</dt>
                             <dd>
-                              <p>
-                                <a href="#concept-return-an-error">Return an error</a> named
-                                <a href="#dfn-DataError"><code>DataError</code></a>.
-                              </p>
+                              <ol>
+                                <li>
+                                  <p>
+                                    Perform any <a href="#dfn-ecdh-extended-import-steps">key
+                                    import steps</a> defined by
+                                    <a href="#dfn-applicable-specifications">other applicable
+                                    specifications</a>, passing <var>format</var>, <var>privateKeyInfo</var>
+                                    and obtaining <var>namedCurve</var>.
+                                  </p>
+                                </li>
+                                <li>
+                                  <p>
+                                    If an error occured or there are no
+                                    <a href="#dfn-applicable-specifications">applicable
+                                    specifications</a>,
+                                    <a href="#concept-return-an-error">return an error</a> named
+                                    <a href="#dfn-DataError"><code>DataError</code></a>.
+                                  </p>
+                                </li>
+                              </ol>
                             </dd>
                           </dl>
                         </li>
@@ -10922,44 +10926,6 @@
                   </p>
                 </li>
                 <li>
-                  <p>
-                    Perform any <a href="#dfn-ecdh-extended-export-steps">key export steps</a>
-                    defined by <a href="#dfn-applicable-specifications">other applicable
-                    specifications</a>, passing <var>key</var> and obtaining <var>result</var>.
-                    <dl class="switch">
-                      <dt>
-                        If <var>format</var> is <code>"spki"</code> or <code>"pkcs8"</code> and
-                        <var>result</var> is an <a href="#dfn-ArrayBuffer">ArrayBuffer</a>
-                        object
-                      </dt>
-                      <dd>
-                        <p>
-                          Return <var>result</var>.
-                        </p>
-                      </dd>
-                      <dt>
-                        If <var>format</var> is <code>"jwk"</code> and
-                        <var>result</var> is not an error
-                      </dt>
-                      <dd>
-                        <p>
-                          Return <var>result</var>.
-                        </p>
-                      </dd>
-                      <dt>
-                        If <var>result</var> is an error with a name that is not
-                        <a href="#dfn-NotSupportedError"><code>NotSupportedError</code></a>
-                      </dt>
-                      <dd>
-                        <p>
-                          <a href="#concept-return-an-error">Return an error</a> with the same name
-                          as <var>result</var>.
-                        </p>
-                      </dd>
-                    </dl>
-                  </p>
-                </li>
-                <li>
                   <dl class="switch">
                     <dt>If <var>format</var> is <code>"spki"</code>:</dt>
                     <dd>
@@ -10995,7 +10961,8 @@
                                 <li>
                                   <p>
                                     Set the <var>parameters</var> field to an instance of the
-                                    <code>namedCurve</code> ASN.1 type as follows:
+                                    <code>ECParameters</code> ASN.1 type defined in
+                                    <a href="#RFC5480">RFC 5480</a> as follows:
                                   </p>
                                   <dl class="switch">
                                     <dt>
@@ -11007,7 +10974,8 @@
                                     </dt>
                                     <dd>
                                       <p>
-                                        Let the <var>namedCurve</var> be the object identifier
+                                        Set <var>parameters</var> to the <var>namedCurve</var> choice
+                                        with value equal to the object identifier
                                         <code>secp256r1</code> defined in <a href="#RFC5480">RFC
                                         5480</a>
                                       </p>
@@ -11021,7 +10989,8 @@
                                     </dt>
                                     <dd>
                                       <p>
-                                        Let the <var>namedCurve</var> be the object identifier
+                                        Set <var>parameters</var> to the <var>namedCurve</var> choice
+                                        with value equal to the object identifier
                                         <code>secp384r1</code> defined in <a href="#RFC5480">RFC
                                         5480</a>
                                       </p>
@@ -11035,11 +11004,36 @@
                                     </dt>
                                     <dd>
                                       <p>
-                                        Let the <var>namedCurve</var> be the object identifier
+                                        Set <var>parameters</var> to the <var>namedCurve</var> choice
+                                        with value equal to the object identifier
                                         <code>secp521r1</code> defined in <a href="#RFC5480">RFC
                                         5480</a>
                                       </p>
                                     </dd>
+                                    <dt>
+                                      Otherwise:
+                                    </dt>
+                                    <dd>
+                                      <ol>
+                                        <li>
+                                          <p>
+                                            Perform any <a href="#dfn-ecdh-extended-export-steps">key export steps</a>
+                                            defined by <a href="#dfn-applicable-specifications">other applicable
+                                            specifications</a>, passing <var>format</var> and the
+                                            <a href="#dfn-EcKeyAlgorithm-namedCurve">namedCurve</a> attribute of
+                                            the [[<a href="#dfn-CryptoKey-slot-algorithm">algorithm</a>]]
+                                            internal slot of <var>key</var>
+                                            and obtaining <var>namedCurveOid</var>.
+                                          </p>
+                                        </li>
+                                        <li>
+                                          <p>
+                                            Set <var>parameters</var> to the <code>namedCurve</code> choice
+                                            with value equal to the object identifier <var>namedCurveOid</var>.
+                                          </p>
+                                        </li>
+                                      </ol>
+                                    </dd>
                                   </dl>
                                 </li>
                               </ul>
@@ -11097,7 +11091,8 @@
                                 <li>
                                   <p>
                                     Set the <var>parameters</var> field to an instance of the
-                                    <code>namedCurve</code> ASN.1 type as follows:
+                                    <code>ECParameters</code> ASN.1 type defined in
+                                    <a href="#RFC5480">RFC 5480</a> as follows:
                                   </p>
                                   <dl class="switch">
                                     <dt>
@@ -11109,7 +11104,8 @@
                                     </dt>
                                     <dd>
                                       <p>
-                                        Let the <var>namedCurve</var> be the object identifier
+                                        Set <var>parameters</var> to the <var>namedCurve</var> choice
+                                        with value equal to the object identifier
                                         <code>secp256r1</code> defined in <a href="#RFC5480">RFC
                                         5480</a>
                                       </p>
@@ -11123,7 +11119,8 @@
                                     </dt>
                                     <dd>
                                       <p>
-                                        Let the <var>namedCurve</var> be the object identifier
+                                        Set <var>parameters</var> to the <var>namedCurve</var> choice
+                                        with value equal to the object identifier
                                         <code>secp384r1</code> defined in <a href="#RFC5480">RFC
                                         5480</a>
                                       </p>
@@ -11137,11 +11134,36 @@
                                     </dt>
                                     <dd>
                                       <p>
-                                        Let the <var>namedCurve</var> be the object identifier
+                                        Set <var>parameters</var> to the <var>namedCurve</var> choice
+                                        with value equal to the object identifier
                                         <code>secp521r1</code> defined in <a href="#RFC5480">RFC
                                         5480</a>
                                       </p>
                                     </dd>
+                                    <dt>
+                                      Otherwise:
+                                    </dt>
+                                    <dd>
+                                      <ol>
+                                        <li>
+                                          <p>
+                                            Perform any <a href="#dfn-ecdh-extended-export-steps">key export steps</a>
+                                            defined by <a href="#dfn-applicable-specifications">other applicable
+                                            specifications</a>, passing <var>format</var> and the
+                                            <a href="#dfn-EcKeyAlgorithm-namedCurve">namedCurve</a> attribute of
+                                            the [[<a href="#dfn-CryptoKey-slot-algorithm">algorithm</a>]]
+                                            internal slot of <var>key</var>
+                                            and obtaining <var>namedCurveOid</var>.
+                                          </p>
+                                        </li>
+                                        <li>
+                                          <p>
+                                            Set <var>parameters</var> to the <code>namedCurve</code> choice
+                                            with value equal to the object identifier <var>namedCurveOid</var>.
+                                          </p>
+                                        </li>
+                                      </ol>
+                                    </dd>
                                   </dl>
                                 </li>
                               </ul>
@@ -11226,6 +11248,30 @@
                               Set the <code>crv</code> attribute of <var>jwk</var> to
                               <code>"P-521"</code>
                             </dd>
+                            <dt>
+                              Otherwise:
+                            </dt>
+                            <dd>
+                              <ol>
+                                <li>
+                                  <p>
+                                    Perform any <a href="#dfn-ecdh-extended-export-steps">key export steps</a>
+                                    defined by <a href="#dfn-applicable-specifications">other applicable
+                                    specifications</a>, passing <var>format</var> and the
+                                    <a href="#dfn-EcKeyAlgorithm-namedCurve">namedCurve</a> attribute of
+                                    the [[<a href="#dfn-CryptoKey-slot-algorithm">algorithm</a>]]
+                                    internal slot of <var>key</var>
+                                    and obtaining <var>namedCurve</var>.
+                                  </p>
+                                </li>
+                                <li>
+                                  <p>
+                                    Set the <code>crv</code> attribute of <var>jwk</var> to
+                                    <var>namedCurve</var>.
+                                  </p>
+                                </li>
+                              </ol>
+                            </dd>
                           </dl>
                         </li>
                         <li>
--- a/spec/Overview.html	Wed Oct 15 15:53:42 2014 -0700
+++ b/spec/Overview.html	Wed Oct 15 16:07:19 2014 -0700
@@ -9960,34 +9960,6 @@
                   <p>Let <var>keyData</var> be the key data to be imported.</p>
                 </li>
                 <li>
-                  <p>
-                    Perform any <a href="#dfn-ecdh-extended-import-steps">key import steps</a>
-                    defined by <a href="#dfn-applicable-specifications">other applicable
-                    specifications</a>, passing <var>keyData</var> and obtaining <var>result</var>.
-                    <dl class="switch">
-                      <dt>
-                        If <var>result</var> is a <a href="#dfn-CryptoKey">CryptoKey</a>
-                        object
-                      </dt>
-                      <dd>
-                        <p>
-                          Return <var>result</var>.
-                        </p>
-                      </dd>
-                      <dt>
-                        If <var>result</var> is an error with a name that is not
-                        <a href="#dfn-NotSupportedError"><code>NotSupportedError</code></a>
-                      </dt>
-                      <dd>
-                        <p>
-                          <a href="#concept-return-an-error">Return an error</a> with the same name
-                          as <var>result</var>.
-                        </p>
-                      </dd>
-                    </dl>
-                  </p>
-                </li>
-                <li>
                   <dl class="switch">
                     <dt>If <var>format</var> is <code>"spki"</code>:</dt>
                     <dd>
@@ -10082,10 +10054,26 @@
                             </dd>
                             <dt>Otherwise:</dt>
                             <dd>
-                              <p>
-                                <a href="#concept-return-an-error">Return an error</a> named
-                                <a href="#dfn-DataError"><code>DataError</code></a>.
-                              </p>
+                              <ol>
+                                <li>
+                                  <p>
+                                    Perform any <a href="#dfn-ecdh-extended-import-steps">key
+                                    import steps</a> defined by
+                                    <a href="#dfn-applicable-specifications">other applicable
+                                    specifications</a>, passing <var>format</var>, <var>spki</var>
+                                    and obtaining <var>namedCurve</var>.
+                                  </p>
+                                </li>
+                                <li>
+                                  <p>
+                                    If an error occured or there are no
+                                    <a href="#dfn-applicable-specifications">applicable
+                                    specifications</a>,
+                                    <a href="#concept-return-an-error">return an error</a> named
+                                    <a href="#dfn-DataError"><code>DataError</code></a>.
+                                  </p>
+                                </li>
+                              </ol>
                             </dd>
                           </dl>
                         </li>
@@ -10259,10 +10247,26 @@
                             </dd>
                             <dt>Otherwise:</dt>
                             <dd>
-                              <p>
-                                <a href="#concept-return-an-error">Return an error</a> named
-                                <a href="#dfn-DataError"><code>DataError</code></a>.
-                              </p>
+                              <ol>
+                                <li>
+                                  <p>
+                                    Perform any <a href="#dfn-ecdh-extended-import-steps">key
+                                    import steps</a> defined by
+                                    <a href="#dfn-applicable-specifications">other applicable
+                                    specifications</a>, passing <var>format</var>, <var>privateKeyInfo</var>
+                                    and obtaining <var>namedCurve</var>.
+                                  </p>
+                                </li>
+                                <li>
+                                  <p>
+                                    If an error occured or there are no
+                                    <a href="#dfn-applicable-specifications">applicable
+                                    specifications</a>,
+                                    <a href="#concept-return-an-error">return an error</a> named
+                                    <a href="#dfn-DataError"><code>DataError</code></a>.
+                                  </p>
+                                </li>
+                              </ol>
                             </dd>
                           </dl>
                         </li>
@@ -10563,44 +10567,6 @@
                   </p>
                 </li>
                 <li>
-                  <p>
-                    Perform any <a href="#dfn-ecdh-extended-export-steps">key export steps</a>
-                    defined by <a href="#dfn-applicable-specifications">other applicable
-                    specifications</a>, passing <var>key</var> and obtaining <var>result</var>.
-                    <dl class="switch">
-                      <dt>
-                        If <var>format</var> is <code>"spki"</code> or <code>"pkcs8"</code> and
-                        <var>result</var> is an <a href="#dfn-ArrayBuffer">ArrayBuffer</a>
-                        object
-                      </dt>
-                      <dd>
-                        <p>
-                          Return <var>result</var>.
-                        </p>
-                      </dd>
-                      <dt>
-                        If <var>format</var> is <code>"jwk"</code> and
-                        <var>result</var> is not an error
-                      </dt>
-                      <dd>
-                        <p>
-                          Return <var>result</var>.
-                        </p>
-                      </dd>
-                      <dt>
-                        If <var>result</var> is an error with a name that is not
-                        <a href="#dfn-NotSupportedError"><code>NotSupportedError</code></a>
-                      </dt>
-                      <dd>
-                        <p>
-                          <a href="#concept-return-an-error">Return an error</a> with the same name
-                          as <var>result</var>.
-                        </p>
-                      </dd>
-                    </dl>
-                  </p>
-                </li>
-                <li>
                   <dl class="switch">
                     <dt>If <var>format</var> is <code>"spki"</code>:</dt>
                     <dd>
@@ -10634,7 +10600,8 @@
                                 <li>
                                   <p>
                                     Set the <var>parameters</var> field to an instance of the
-                                    <code>namedCurve</code> ASN.1 type as follows:
+                                    <code>ECParameters</code> ASN.1 type defined in
+                                    <a href="#RFC5480">RFC 5480</a> as follows:
                                   </p>
                                   <dl class="switch">
                                     <dt>
@@ -10644,7 +10611,8 @@
                                     </dt>
                                     <dd>
                                       <p>
-                                        Let the <var>namedCurve</var> be the object identifier
+                                        Set <var>parameters</var> to the <var>namedCurve</var> choice
+                                        with value equal to the object identifier
                                         <code>secp256r1</code> defined in <a href="#RFC5480">RFC
                                         5480</a>
                                       </p>
@@ -10656,7 +10624,8 @@
                                     </dt>
                                     <dd>
                                       <p>
-                                        Let the <var>namedCurve</var> be the object identifier
+                                        Set <var>parameters</var> to the <var>namedCurve</var> choice
+                                        with value equal to the object identifier
                                         <code>secp384r1</code> defined in <a href="#RFC5480">RFC
                                         5480</a>
                                       </p>
@@ -10668,11 +10637,36 @@
                                     </dt>
                                     <dd>
                                       <p>
-                                        Let the <var>namedCurve</var> be the object identifier
+                                        Set <var>parameters</var> to the <var>namedCurve</var> choice
+                                        with value equal to the object identifier
                                         <code>secp521r1</code> defined in <a href="#RFC5480">RFC
                                         5480</a>
                                       </p>
                                     </dd>
+                                    <dt>
+                                      Otherwise:
+                                    </dt>
+                                    <dd>
+                                      <ol>
+                                        <li>
+                                          <p>
+                                            Perform any <a href="#dfn-ecdh-extended-export-steps">key export steps</a>
+                                            defined by <a href="#dfn-applicable-specifications">other applicable
+                                            specifications</a>, passing <var>format</var> and the
+                                            <a href="#dfn-EcKeyAlgorithm-namedCurve">namedCurve</a> attribute of
+                                            the [[<a href="#dfn-CryptoKey-slot-algorithm">algorithm</a>]]
+                                            internal slot of <var>key</var>
+                                            and obtaining <var>namedCurveOid</var>.
+                                          </p>
+                                        </li>
+                                        <li>
+                                          <p>
+                                            Set <var>parameters</var> to the <code>namedCurve</code> choice
+                                            with value equal to the object identifier <var>namedCurveOid</var>.
+                                          </p>
+                                        </li>
+                                      </ol>
+                                    </dd>
                                   </dl>
                                 </li>
                               </ul>
@@ -10727,7 +10721,8 @@
                                 <li>
                                   <p>
                                     Set the <var>parameters</var> field to an instance of the
-                                    <code>namedCurve</code> ASN.1 type as follows:
+                                    <code>ECParameters</code> ASN.1 type defined in
+                                    <a href="#RFC5480">RFC 5480</a> as follows:
                                   </p>
                                   <dl class="switch">
                                     <dt>
@@ -10737,7 +10732,8 @@
                                     </dt>
                                     <dd>
                                       <p>
-                                        Let the <var>namedCurve</var> be the object identifier
+                                        Set <var>parameters</var> to the <var>namedCurve</var> choice
+                                        with value equal to the object identifier
                                         <code>secp256r1</code> defined in <a href="#RFC5480">RFC
                                         5480</a>
                                       </p>
@@ -10749,7 +10745,8 @@
                                     </dt>
                                     <dd>
                                       <p>
-                                        Let the <var>namedCurve</var> be the object identifier
+                                        Set <var>parameters</var> to the <var>namedCurve</var> choice
+                                        with value equal to the object identifier
                                         <code>secp384r1</code> defined in <a href="#RFC5480">RFC
                                         5480</a>
                                       </p>
@@ -10761,11 +10758,36 @@
                                     </dt>
                                     <dd>
                                       <p>
-                                        Let the <var>namedCurve</var> be the object identifier
+                                        Set <var>parameters</var> to the <var>namedCurve</var> choice
+                                        with value equal to the object identifier
                                         <code>secp521r1</code> defined in <a href="#RFC5480">RFC
                                         5480</a>
                                       </p>
                                     </dd>
+                                    <dt>
+                                      Otherwise:
+                                    </dt>
+                                    <dd>
+                                      <ol>
+                                        <li>
+                                          <p>
+                                            Perform any <a href="#dfn-ecdh-extended-export-steps">key export steps</a>
+                                            defined by <a href="#dfn-applicable-specifications">other applicable
+                                            specifications</a>, passing <var>format</var> and the
+                                            <a href="#dfn-EcKeyAlgorithm-namedCurve">namedCurve</a> attribute of
+                                            the [[<a href="#dfn-CryptoKey-slot-algorithm">algorithm</a>]]
+                                            internal slot of <var>key</var>
+                                            and obtaining <var>namedCurveOid</var>.
+                                          </p>
+                                        </li>
+                                        <li>
+                                          <p>
+                                            Set <var>parameters</var> to the <code>namedCurve</code> choice
+                                            with value equal to the object identifier <var>namedCurveOid</var>.
+                                          </p>
+                                        </li>
+                                      </ol>
+                                    </dd>
                                   </dl>
                                 </li>
                               </ul>
@@ -10845,6 +10867,30 @@
                               Set the <code>crv</code> attribute of <var>jwk</var> to
                               <code>"P-521"</code>
                             </dd>
+                            <dt>
+                              Otherwise:
+                            </dt>
+                            <dd>
+                              <ol>
+                                <li>
+                                  <p>
+                                    Perform any <a href="#dfn-ecdh-extended-export-steps">key export steps</a>
+                                    defined by <a href="#dfn-applicable-specifications">other applicable
+                                    specifications</a>, passing <var>format</var> and the
+                                    <a href="#dfn-EcKeyAlgorithm-namedCurve">namedCurve</a> attribute of
+                                    the [[<a href="#dfn-CryptoKey-slot-algorithm">algorithm</a>]]
+                                    internal slot of <var>key</var>
+                                    and obtaining <var>namedCurve</var>.
+                                  </p>
+                                </li>
+                                <li>
+                                  <p>
+                                    Set the <code>crv</code> attribute of <var>jwk</var> to
+                                    <var>namedCurve</var>.
+                                  </p>
+                                </li>
+                              </ol>
+                            </dd>
                           </dl>
                         </li>
                         <li>