Bug 25465 - Validate the "alg" parameter of ECDSA JWKs as being consistent with the import parameters and the crv parameter
authorRyan Sleevi <sleevi@google.com>
Mon, 16 Jun 2014 00:00:00 -0700
changeset 192 d49793c63670
parent 191 e0cd6df0a473
child 193 816f8e52efa6
Bug 25465 - Validate the "alg" parameter of ECDSA JWKs as being consistent with the import parameters and the crv parameter
spec/Overview-WebCryptoAPI.xml
spec/Overview.html
--- a/spec/Overview-WebCryptoAPI.xml	Mon Jun 16 00:00:00 2014 -0700
+++ b/spec/Overview-WebCryptoAPI.xml	Mon Jun 16 00:00:00 2014 -0700
@@ -8716,6 +8716,45 @@
                             </p>
                           </li>
                           <li>
+                            <p>
+                              Let <var>algNamedCurve</var> be a string whose initial value is
+                              undefined.
+                            </p>
+                          </li>
+                          <li>
+                            <dl class="switch">
+                              <dt>If the <code>"alg"</code> field is present:</dt>
+                              <dd>
+                                Let <var>algNamedCurve</var> be undefined.
+                              </dd>
+                              <dt>
+                                If the <code>"alg"</code> field is equal to the string "ES256":
+                              </dt>
+                              <dd>
+                                Let <var>algNamedCurve</var> be the string <code>P-256</code>.
+                              </dd>
+                              <dt>
+                                If the <code>"alg"</code> field is equal to the string "ES384":
+                              </dt>
+                              <dd>
+                                Let <var>algNamedCurve</var> be the string <code>P-384</code>.
+                              </dd>
+                              <dt>
+                                If the <code>"alg"</code> field is equal to the string "ES521":
+                              </dt>
+                              <dd>
+                                Let <var>algNamedCurve</var> be the string <code>P-521</code>.
+                              </dd>
+                            </dl>
+                          </li>
+                          <li>
+                            <p>
+                              If <var>algNamedCurve</var> is defined, and is not equal to
+                              <var>namedCurve</var>, <a href="#concept-return-an-error">return an
+                              error</a> named <a href="#dfn-DataError"><code>DataError</code></a>.
+                            </p>
+                          </li>
+                          <li>
                             <dl class="switch">
                               <dt>If the <code>"d"</code> field is present:</dt>
                               <dd>
@@ -9168,13 +9207,6 @@
               </dd>
             </dl>
           </div>
-          <div class="ednote">
-            <p>
-              OPEN ISSUE: The import/export of JWK ignores the "alg" field, because it does not
-              provide a 1:1 mapping between ECDSA (which choses the hash at sign/verify time,
-              because it is safe to do so) and the JWS alg (which incorporates the hash algorithm).
-            </p>
-          </div>
         </div>
 
         <div id="ecdh" class="section">
--- a/spec/Overview.html	Mon Jun 16 00:00:00 2014 -0700
+++ b/spec/Overview.html	Mon Jun 16 00:00:00 2014 -0700
@@ -44,7 +44,7 @@
         communications.
       </p>
   
-      <div class="ednote"><div class="ednoteHeader">Editorial note</div><p>There are 19 further editorial notes in the document.</p></div>
+      <div class="ednote"><div class="ednoteHeader">Editorial note</div><p>There are 18 further editorial notes in the document.</p></div>
     </div>
 
     <div class="section">
@@ -8484,6 +8484,45 @@
                             </p>
                           </li>
                           <li>
+                            <p>
+                              Let <var>algNamedCurve</var> be a string whose initial value is
+                              undefined.
+                            </p>
+                          </li>
+                          <li>
+                            <dl class="switch">
+                              <dt>If the <code>"alg"</code> field is present:</dt>
+                              <dd>
+                                Let <var>algNamedCurve</var> be undefined.
+                              </dd>
+                              <dt>
+                                If the <code>"alg"</code> field is equal to the string "ES256":
+                              </dt>
+                              <dd>
+                                Let <var>algNamedCurve</var> be the string <code>P-256</code>.
+                              </dd>
+                              <dt>
+                                If the <code>"alg"</code> field is equal to the string "ES384":
+                              </dt>
+                              <dd>
+                                Let <var>algNamedCurve</var> be the string <code>P-384</code>.
+                              </dd>
+                              <dt>
+                                If the <code>"alg"</code> field is equal to the string "ES521":
+                              </dt>
+                              <dd>
+                                Let <var>algNamedCurve</var> be the string <code>P-521</code>.
+                              </dd>
+                            </dl>
+                          </li>
+                          <li>
+                            <p>
+                              If <var>algNamedCurve</var> is defined, and is not equal to
+                              <var>namedCurve</var>, <a href="#concept-return-an-error">return an
+                              error</a> named <a href="#dfn-DataError"><code>DataError</code></a>.
+                            </p>
+                          </li>
+                          <li>
                             <dl class="switch">
                               <dt>If the <code>"d"</code> field is present:</dt>
                               <dd>
@@ -8908,13 +8947,6 @@
               </dd>
             </dl>
           </div>
-          <div class="ednote"><div class="ednoteHeader">Editorial note</div>
-            <p>
-              OPEN ISSUE: The import/export of JWK ignores the "alg" field, because it does not
-              provide a 1:1 mapping between ECDSA (which choses the hash at sign/verify time,
-              because it is safe to do so) and the JWS alg (which incorporates the hash algorithm).
-            </p>
-          </div>
         </div>
 
         <div id="ecdh" class="section">