Remove the subclasses of KeyOperation, treating all key-based operations as a
authorRyan Sleevi <sleevi@google.com>
Mon, 10 Dec 2012 00:45:23 -0800
changeset 20 2f4f03785843
parent 19 7b1f9a44887d
child 21 d9cad130b21e
Remove the subclasses of KeyOperation, treating all key-based operations as a
simple Promise-style onsuccess/onerror/result holder. This also attempts to
clarify how operations such as generateKey behave with respect to asynchronous
processing.
spec/Overview-WebCryptoAPI.xml
spec/Overview.html
--- a/spec/Overview-WebCryptoAPI.xml	Mon Dec 10 00:43:38 2012 -0800
+++ b/spec/Overview-WebCryptoAPI.xml	Mon Dec 10 00:45:23 2012 -0800
@@ -592,7 +592,8 @@
           <dfn id="dfn-task">task</dfn>,
           <dfn id="task-source">task source</dfn>,
           <dfn id="df-URL">URL</dfn>,
-          <dfn id="queue-a-task">queue a task</dfn>, and
+          <dfn id="queue-a-task">queue a task</dfn>,
+          <dfn id="fire-a-simple-event">fire a simple event</dfn>, and
           <dfn id="structured-clone">structured clone</dfn>,
           are defined by the HTML specification [<a href="#HTML">HTML</a>].
         </p>
@@ -838,8 +839,8 @@
               <ul>
                 <li><a href="#dfn-Key-type">type</a></li>
                 <li><a href="#dfn-Key-extractable">extractable</a></li>
-                <li><a href="#dfn-Key-Algorithm">Algorithm</a></li>
-                <li><a href="#dfn-Key-KeyUsage">KeyUsage</a></li>
+                <li><a href="#dfn-Key-algorithm">Algorithm</a></li>
+                <li><a href="#dfn-Key-keyUsage">KeyUsage</a></li>
               </ul>
             </li>
             <li>
@@ -1076,7 +1077,8 @@
             </li>
             <li>
               <p>
-                <a href="#fire-a-simple-event">Fire an event</a> named <a href="#dfn-CryptoOperation-onprogress"><code>onprogress</code></a>
+                <a href="#fire-a-simple-event">fire a simple event</a> named
+                <a href="#dfn-CryptoOperation-onprogress"><code>onprogress</code></a>
                 at the <a href="#dfn-CryptoOperation"><code>CryptoOperation</code></a>.
               </p>
             </li>
@@ -1260,7 +1262,7 @@
                 <p>
                   Once all items in the <a href="#dfn-CryptoOperation-list-of-pending-data">list of pending data</a> have
                   been <a href="#dfn-CryptoOperation-process-data">processed</a>, <a href="#queue-a-task">queue a task</a>
-                  to <a href="#fire-a-simple-event">fire an event</a> called
+                  to <a href="#fire-a-simple-event">fire a simple event</a> called
                   <a href="#dfn-CryptoOperation-oncomplete"><code>oncomplete</code></a> at the
                   <a href="#dfn-CryptoOperation"><code>CryptoOperation</code></a>.
                 </p>
@@ -1289,12 +1291,16 @@
                 one of the task queues, then remove those tasks.
               </li>
               <li>
-                Fire an event called <a href="#dfn-onabort-event"><code>abort</code></a>.
+                <a href="#fire-a-simple-event">Fire a simple event</a> called
+                <a href="#dfn-onabort-event"><code>onabort</code></a> at the
+                <a href="#dfn-CryptoOperation"><code>CryptoOperation</code></a>.
               </li>
             </ol>
             <div class="ednote">
               <p>
-                The above algorithm is underspecified.
+                The above algorithm is underspecified, both for user agents that do not implement abortable processing and
+                because the <a href="#dfn-CryptoOperation-process-data">process data algorithm</a> does not define how
+                to abort midstream.
               </p>
             </div>
           </div>
@@ -1307,14 +1313,14 @@
 interface <dfn id="dfn-KeyOperation">KeyOperation</dfn> : EventTarget {
   readonly attribute any <a href="#dfn-KeyOperation-result">result</a>;
 
-  [TreatNonCallableAsNull] attribute Function? <a href="#dfn-KeyGenerator-onerror">onerror</a>;
-  [TreatNonCallableAsNull] attribute Function? <a href="#dfn-KeyGenerator-oncomplete">oncomplete</a>;
+  [TreatNonCallableAsNull] attribute Function? <a href="#dfn-KeyOperation-onerror">onerror</a>;
+  [TreatNonCallableAsNull] attribute Function? <a href="#dfn-KeyOperation-oncomplete">oncomplete</a>;
 };
         </x:codeblock>
       </div>
       
-      <div id="KeyImporter-interface" class="section">
-        <h2>KeyImporter interface</h2>
+      <div id="crypto-interface" class="section">
+        <h2>Crypto interface</h2>
         <x:codeblock language="idl">
 enum <dfn id="dfn-KeyFormat">KeyFormat</dfn> {
   <span class="comment">// An unformatted sequence of bytes. Intended for secret keys.</span>
@@ -1327,24 +1333,6 @@
   "jwk",
 };
 
-interface <dfn id="dfn-KeyImporter">KeyImporter</dfn> : <a href="#dfn-KeyOperation">KeyOperation</a> {
-  readonly attribute <a href="#dfn-KeyFormat">KeyFormat</a> format;
-};
-        </x:codeblock>
-      </div>
-      
-      <div id="KeyExporter-interface" class="section">
-        <h2>KeyExporter interface</h2>
-        <x:codeblock language="idl">
-interface <dfn id="dfn-KeyExporter">KeyExporter</dfn> : <a href="#dfn-KeyOperation">KeyOperation</a> {
-  readonly attribute <a href="#dfn-KeyFormat">KeyFormat</a> format;
-};
-        </x:codeblock>
-      </div>
-      
-      <div id="crypto-interface" class="section">
-        <h2>Crypto interface</h2>
-        <x:codeblock language="idl">
 interface <dfn id="dfn-crypto">Crypto</dfn> {
   <a href="#dfn-CryptoOperation">CryptoOperation</a> <a href="#dfn-Crypto-method-encrypt">encrypt</a>(<a href="#dfn-AlgorithmIdentifier">AlgorithmIdentifier</a> algorithm, <a href="#dfn-Key">Key</a> key, optional ArrayBufferView? buffer = null);
   <a href="#dfn-CryptoOperation">CryptoOperation</a> <a href="#dfn-Crypto-method-decrypt">decrypt</a>(<a href="#dfn-AlgorithmIdentifier">AlgorithmIdentifier</a> algorithm, <a href="#dfn-Key">Key</a> key, optional ArrayBufferView? buffer = null);
@@ -1353,22 +1341,22 @@
   <a href="#dfn-CryptoOperation">CryptoOperation</a> <a href="#dfn-Crypto-method-digest">digest</a>(<a href="#dfn-AlgorithmIdentifier">AlgorithmIdentifier</a> algorithm, optional ArrayBufferView? buffer = null);
 
   <span class="comment">// TBD: <a href="https://www.w3.org/2012/webcrypto/track/issues/36">ISSUE-36</a></span>
-  <a href="#dfn-KeyGenerator">KeyGenerator</a> <a href="#dfn-Crypto-method-generateKey">generateKey</a>(<a href="#dfn-AlgorithmIdentifier">AlgorithmIdentifier</a> algorithm,
+  <a href="#dfn-KeyOperation">KeyOperation</a> <a href="#dfn-Crypto-method-generateKey">generateKey</a>(<a href="#dfn-AlgorithmIdentifier">AlgorithmIdentifier</a> algorithm,
                            bool extractable = false,
                            <a href="#dfn-KeyUsage">KeyUsage</a>[] keyUsages = []);
-  <a href="#dfn-KeyDeriver">KeyDeriver</a> <a href="#dfn-Crypto-method-deriveKey">deriveKey</a>(<a href="#dfn-AlgorithmIdentifier">AlgorithmIdentifier</a> algorithm,
+  <a href="#dfn-KeyOperation">KeyOperation</a> <a href="#dfn-Crypto-method-deriveKey">deriveKey</a>(<a href="#dfn-AlgorithmIdentifier">AlgorithmIdentifier</a> algorithm,
                          <a href="#dfn-Key">Key</a> baseKey,
                          <a href="#dfn-AlgorithmIdentifier">AlgorithmIdentifier</a>? derivedKeyType,
                          bool extractable = false,
                          <a href="#dfn-KeyUsage">KeyUsage</a>[] keyUsages = []);
   
   <span class="comment">// TBD: <a href="https://www.w3.org/2012/webcrypto/track/issues/35">ISSUE-35</a></span>
-  <a href="#dfn-KeyImporter">KeyImporter</a> <a href="#dfn-Crypto-method-importKey">importKey</a>(<a href="#dfn-KeyFormat">KeyFormat</a> format,
-                         ArrayBufferView key,
+  <a href="#dfn-KeyOperation">KeyOperation</a> <a href="#dfn-Crypto-method-importKey">importKey</a>(<a href="#dfn-KeyFormat">KeyFormat</a> format,
+                         ArrayBufferView keyData,
                          <a href="#dfn-AlgorithmIdentifier">AlgorithmIdentifier</a>? algorithm,
                          bool extractable = false,
                          <a href="#dfn-KeyUsage">KeyUsage</a>[] keyUsages = []);
-  <a href="#dfn-KeyExporter">KeyExporter</a> <a href="#dfn-Crypto-method-exportKey">exportKey</a>(<a href="#dfn-KeyFormat">KeyFormat</a> format, <a href="#dfn-Key">Key</a> key);
+  <a href="#dfn-KeyOperation">KeyOperation</a> <a href="#dfn-Crypto-method-exportKey">exportKey</a>(<a href="#dfn-KeyFormat">KeyFormat</a> format, <a href="#dfn-Key">Key</a> key);
 };
 
 <a href="#dfn-Crypto">Crypto</a> implements <a href="#dfn-RandomSource">RandomSource</a>;
@@ -1907,12 +1895,98 @@
           <div id="Crypto-method-generateKey" class="section">
             <h4>The generateKey method</h4>
             <p>
+              When invoked, this method <span class="RFC2119">MUST</span> perform the following steps:
             </p>
+            <ol>
+              <li>
+                <p>
+                  Let <var>normalizedAlgorithm</var> be the result of processing
+                  <code>algorithm</code> according to the
+                  <a href="#algorithm-normalizing-rules">algorithm normalizing rules</a>.
+                </p>
+              </li>
+              <li>
+                <p>
+                  If <var>normalizedAlgorithm</var> does not describe a
+                  <a href="#algorithms">registered algorithm</a> that supports the generate
+                  operation, throw a <code>NotSupportedError</code> and
+                  <dfn id="terminate-the-algorithm">terminate the algorithm</dfn>.
+                </p>
+              </li>
+              <li>
+                <p>
+                  Let <var>keyOp</var> be a newly created object implementing the
+                  <a href="#dfn-KeyOperation"><code>KeyOperation</code></a> interface.
+                </p>
+              </li>
+              <li>
+                <p>
+                  Return <var>keyOp</var> to the task that invoked this <code>generateKey</code>, while
+                  continuing the remaining steps of this algorithm.
+                </p>
+              </li>
+              <li>
+                <p>
+                  Queue up an operation to run the following steps:
+                </p>
+                <ol>
+                  <li>
+                  </li>
+                  <li>
+                    <p>
+                      Invoke the algorithm-specific key generation method.
+                    </p>
+                  </li>
+                  <li>
+                    <p>
+                      If an error occured, <a href="#queue-a-task">queue a task</a> to
+                      <a href="#fire-a-simple-event">fire a simple event</a>
+                      called <a href="#dfn-KeyOperation-onerror"><code>onerror</code></a> at
+                      <var>KeyOp</var> and terminate this algorithm.
+                    </p>
+                  </li>
+                  <li>
+                    <p>
+                      Otherwise, if the algorithm-specific key generation method completed successfully,
+                      let <var>result</var> be the result of that operation.
+                    </p>
+                  </li>
+                  <li>
+                    <p>
+                      Set <var>keyOp</var>.<a href="#dfn-KeyOperation-result"><code>result</code></a> =
+                      <var>result</var>
+                    </p>
+                  </li>
+                  <li>
+                    <p>
+                      <a href="#queue-a-task">Queue a task</a> to
+                      <a href="#fire-a-simple-event">fire a simple event</a> called
+                      <a href="#dfn-KeyOperation-oncomplete"><code>oncomplete</code></a> at
+                      <var>KeyOp</var>
+                    </p>
+                  </li>
+                </ol>
+              </li>
+            </ol>
             <div class="ednote">
               <ul>
                 <li>
-                  <a href="https://www.w3.org/2012/webcrypto/track/issues/16">ISSUE-16</a>:
-                  Should callers be able to specify key lifetime?
+                  <p>
+                    The handling for <var>extractable</var> and <var>keyUsages</var> are currently
+                    underspecified. The <em>intent</em> is that any derived secret/private keys will
+                    reflect whatever the caller specified. However, the exact wording of how to specify
+                    that remains TBD.
+                  </p>
+                  <p>
+                    Consider, for example, generation of an RSA key pair. The intent may be that the public
+                    key has the "verify" usage, and the private key has the "sign" usage, but there is no
+                    way in the API to specify that. The same concern applies for "encrypt" and "decrypt".
+                  </p>
+                  <p>
+                    An alternative would be to allow the caller to write to the attributes on individual
+                    <a href="#dfn-Key"><code>Key</code></a> objects themselves, after generation, and then
+                    have some operation to finalize the object itself, but this as well remains TBD.
+                  </p>
                 </li>
               </ul>
             </div>
@@ -1920,8 +1994,113 @@
           
           <div id="Crypto-method-deriveKey" class="section">
             <h4>The deriveKey method</h4>
-            <p></p>
+            <p>
+              When invoked, this method <span class="RFC2119">MUST</span> perform the following steps:
+            </p>
+            <ol>
+              <li>
+                <p>
+                  Let <var>normalizedAlgorithm</var> be the result of processing
+                  <code>algorithm</code> according to the
+                  <a href="#algorithm-normalizing-rules">algorithm normalizing rules</a>.
+                </p>
+              </li>
+              <li>
+                <p>
+                  If <var>normalizedAlgorithm</var> does not describe a
+                  <a href="#algorithms">registered algorithm</a> that supports the derive
+                  operation, throw a <code>NotSupportedError</code> and
+                  <dfn id="terminate-the-algorithm">terminate the algorithm</dfn>.
+                </p>
+              </li>
+              <li>
+                <p>
+                  Let <var>keyOp</var> be a newly created object implementing the
+                  <a href="#dfn-KeyOperation"><code>KeyOperation</code></a> interface.
+                </p>
+              </li>
+              <li>
+                <p>
+                  Return <var>keyOp</var> to the task that invoked this <code>generateKey</code>, while
+                  continuing the remaining steps of this algorithm.
+                </p>
+              </li>
+              <li>
+                <p>
+                  Queue up an operation to run the following steps:
+                </p>
+                <ol>
+                  <li>
+                    <p>
+                      If <var>baseKey</var>.<a href="#dfn-Key-keyUsage"><code>keyUsage</code></a> does not
+                      contain the <code>"derive"</code> <a href="#dfn-KeyUsage"><code>KeyUsage</code></a>,
+                      <a href="#queue-a-task">queue a task</a> to
+                      <a href="#fire-a-simple-event">fire a simple event</a>
+                      called <a href="#dfn-KeyOperation-onerror"><code>onerror</code></a> at
+                      <var>KeyOp</var> and terminate this algorithm.
+                    </p>
+                  </li>
+                  <li>
+                    <p>
+                      Invoke the algorithm-specific key generation method.
+                    </p>
+                  </li>
+                  <li>
+                    <p>
+                      If an error occured, <a href="#queue-a-task">queue a task</a> to
+                      <a href="#fire-a-simple-event">fire a simple event</a>
+                      called <a href="#dfn-KeyOperation-onerror"><code>onerror</code></a> at
+                      <var>KeyOp</var> and terminate this algorithm.
+                    </p>
+                  </li>
+                  <li>
+                    <p>
+                      Otherwise, if the algorithm-specific key derivation method completed successfully,
+                      let <var>result</var> be the result of that operation.
+                    </p>
+                  </li>
+                  <li>
+                    <p>
+                      Set <var>keyOp</var>.<a href="#dfn-KeyOperation-result"><code>result</code></a> =
+                      <var>result</var>
+                    </p>
+                  </li>
+                  <li>
+                    <p>
+                      <a href="#queue-a-task">Queue a task</a> to
+                      <a href="#fire-a-simple-event">fire a simple event</a> called
+                      <a href="#dfn-KeyOperation-oncomplete"><code>oncomplete</code></a> at
+                      <var>KeyOp</var>
+                    </p>
+                  </li>
+                </ol>
+              </li>
+            </ol>
+            <div class="ednote">
+              <ul>
+                <li>
+                  <p>
+                    The handling for <var>extractable</var> and <var>keyUsages</var> are currently
+                    underspecified. The <em>intent</em> is that any derived secret/private keys will
+                    reflect whatever the caller specified. However, the exact wording of how to specify
+                    that remains TBD.
+                  </p>
+                  <p>
+                    Consider, for example, when derivation results in multiple key handles. The intent
+                    may be that one <code>Key</code> object is used for <code>encrypt</code>ing, while
+                    another is used for <code>decrypt</code>ing. However, the current way of specifying
+                    <code>KeyUsage</code> does not provide a means for callers to do so.
+                  </p>
+                  <p>
+                    An alternative would be to allow the caller to write to the attributes on individual
+                    <a href="#dfn-Key"><code>Key</code></a> objects themselves, after generation, and then
+                    have some operation to finalize the object itself, but this as well remains TBD.
+                  </p>
+                </li>
+              </ul>
+            </div>
           </div>
+
           <div id="Crypto-method-importKey" class="section">
             <h4>The importKey method</h4>
             <p></p>
@@ -2313,8 +2492,6 @@
               </dd>
               <dt>Generate Key</dt>
               <dd>
-                When generating a key pair, the resultant <code><a href="#dfn-KeyGenerator">KeyGenerator</a></code>
-                shall behave as follows:
               </dd>
             </dl>
           </div>
@@ -2710,8 +2887,6 @@
               </dd>
               <dt>Generate Key</dt>
               <dd>
-                When generating a key pair, the resultant <code><a href="#dfn-KeyGenerator">KeyGenerator</a></code>
-                shall behave as follows:
               </dd>
             </dl>
           </div>
--- a/spec/Overview.html	Mon Dec 10 00:43:38 2012 -0800
+++ b/spec/Overview.html	Mon Dec 10 00:45:23 2012 -0800
@@ -49,7 +49,7 @@
 communications.
       </p>
   
-      <div class="ednote"><div class="ednoteHeader">Editorial note</div><p>There are 20 further editorial notes in the document.</p></div>
+      <div class="ednote"><div class="ednoteHeader">Editorial note</div><p>There are 21 further editorial notes in the document.</p></div>
     </div>
 
     <div class="section">
@@ -145,7 +145,7 @@
 
     <div id="toc">
       <h2>Table of Contents</h2>
-      <div class="toc"><ul><li><a href="#introduction">1. Introduction</a></li><li><a href="#use-cases">2. Use Cases</a><ul><li><a href="#multifactor-authentication">2.1. Multi-factor Authentication</a></li><li><a href="#protected-document">2.2. Protected Document Exchange</a></li><li><a href="#cloud-storage">2.3. Cloud Storage</a></li><li><a href="#document-signing">2.4. Document Signing</a></li><li><a href="#data-integrity-protection">2.5. Data Integrity Protection</a></li><li><a href="#secure-messaging">2.6. Secure Messaging</a></li><li><a href="#jose">2.7. Javascript Object Signing and Encryption (JOSE)</a></li></ul></li><li><a href="#conformance">3. Conformance</a></li><li><a href="#scope">4. Scope</a><ul><li><a href="#scope-abstraction">4.1. Level of abstraction</a></li><li><a href="#scope-algorithms">4.2. Cryptographic algorithms</a></li><li><a href="#scope-operations">4.3. Operations</a></li><li><a href="#scope-out-of-scope">4.4. Out of scope</a></li></ul></li><li><a href="#security">5. Security considerations</a><ul><li><a href="#security-implementers">5.1. Security considerations for implementers</a></li><li><a href="#security-developers">5.2. Security considerations for developers</a></li></ul></li><li><a href="#privacy">6. Privacy considerations</a></li><li><a href="#dependencies">7. Dependencies</a></li><li><a href="#terminology">8. Terminology</a></li><li><a href="#RandomSource-interface">9. RandomSource interface</a><ul><li><a href="#RandomSource-description">9.1. Description</a></li><li><a href="#RandomSource-interface-methods">9.2. Methods and Parameters</a><ul><li><a href="#RandomSource-method-getRandomValues">9.2.1. The getRandomValues method</a></li></ul></li></ul></li><li><a href="#algorithm-dictionary">10. Algorithm dictionary</a><ul><li><a href="#algorithm-dictionary-members">10.1. Algorithm Dictionary Members</a></li></ul></li><li><a href="#key-interface">11. Key interface</a><ul><li><a href="#key-interface-description">11.1. Description</a></li><li><a href="#key-interface-members">11.2. Key interface members</a></li><li><a href="#key-interface-clone">11.3. Structured clone algorithm</a></li></ul></li><li><a href="#cryptooperation-interface">12. CryptoOperation interface</a><ul><li><a href="#CryptoOperation-processing-model">12.1. Processing Model</a></li><li><a href="#cryptooperation-events">12.2. Event Handler Attributes</a></li><li><a href="#CryptoOperation-attributes">12.3. Attributes</a></li><li><a href="#CryptoOperation-methods">12.4. Methods</a><ul><li><a href="#CryptoOperation-method-process">12.4.1. process(ArrayBufferView data)</a></li><li><a href="#CryptoOperation-method-finish">12.4.2. The finish() method</a></li><li><a href="#CryptoOperation-method-abort">12.4.3. The abort() method</a></li></ul></li></ul></li><li><a href="#KeyOperation-interface">13. KeyOperation interface</a></li><li><a href="#KeyImporter-interface">14. KeyImporter interface</a></li><li><a href="#KeyExporter-interface">15. KeyExporter interface</a></li><li><a href="#crypto-interface">16. Crypto interface</a><ul><li><a href="#crypto-interface-methods">16.1. Methods and Parameters</a><ul><li><a href="#Crypto-method-encrypt">16.1.1. The encrypt method</a></li><li><a href="#Crypto-method-decrypt">16.1.2. The decrypt method</a></li><li><a href="#Crypto-method-sign">16.1.3. The sign method</a></li><li><a href="#Crypto-method-verify">16.1.4. The verify method</a></li><li><a href="#Crypto-method-digest">16.1.5. The digest method</a></li><li><a href="#Crypto-method-generateKey">16.1.6. The generateKey method</a></li><li><a href="#Crypto-method-deriveKey">16.1.7. The deriveKey method</a></li><li><a href="#Crypto-method-importKey">16.1.8. The importKey method</a></li><li><a href="#Crypto-method-exportKey">16.1.9. The exportKey method</a></li></ul></li></ul></li><li><a href="#WorkerCrypto-interface">17. WorkerCrypto interface</a><ul><li><a href="#WorkerCrypto-description">17.1. Description</a></li></ul></li><li><a href="#big-integer">18. BigInteger</a></li><li><a href="#keypair">19. KeyPair</a></li><li><a href="#key-discovery">20. Key Discovery</a></li><li><a href="#algorithms">21. Algorithms</a><ul><li><a href="#recommended-algorithms">21.1. Recommended algorithms</a></li><li><a href="#defining-an-algorithm">21.2. Defining an algorithm</a><ul><li><a href="#recognized-algorithm-name">21.2.1. Recognized algorithm name</a></li><li><a href="#supported-operations">21.2.2. Supported operations</a></li><li><a href="#algorithm-specific-params">21.2.3. Algorithm-specific parameters</a></li><li><a href="#algorithm-result">21.2.4. Algorithm results</a></li><li><a href="#algorithm-alias">21.2.5. Algorithm aliases</a></li></ul></li><li><a href="#rsaes-pkcs1">21.3. RSAES-PKCS1-v1_5</a><ul><li><a href="#rsaes-pkcs1-description">21.3.1. Description</a></li><li><a href="#rsaes-pkcs1-registration">21.3.2. Registration</a></li><li><a href="#RsaKeyGenParams-dictionary">21.3.3. RsaKeyGenParams dictionary</a></li><li><a href="#rsaes-pkcs1-operations">21.3.4. Operations</a></li></ul></li><li><a href="#rsassa-pkcs1">21.4. RSASSA-PKCS1-v1_5</a><ul><li><a href="#rsassa-pkcs1-description">21.4.1. Description</a></li><li><a href="#rsassa-pkcs1-registration">21.4.2. Registration</a></li><li><a href="#RsaSsaParams-dictionary">21.4.3. RsaSsaParams dictionary</a></li><li><a href="#rsassa-pkcs1-operations">21.4.4. Operations</a></li></ul></li><li><a href="#rsa-pss">21.5. RSA-PSS</a><ul><li><a href="#rsa-pss-description">21.5.1. Description</a></li><li><a href="#rsa-pss-registration">21.5.2. Registration</a></li><li><a href="#rsa-pss-params">21.5.3. RsaPssParams dictionary</a></li><li><a href="#rsa-pss-operations">21.5.4. Operations</a></li></ul></li><li><a href="#rsa-oaep">21.6. RSA-OAEP</a><ul><li><a href="#rsa-oaep-description">21.6.1. Description</a></li><li><a href="#rsa-oaep-registration">21.6.2. Registration</a></li><li><a href="#rsa-oaep-params">21.6.3. RsaOaepParams dictionary</a></li><li><a href="#rsa-oaep-operations">21.6.4. Operations</a></li></ul></li><li><a href="#ecdsa">21.7. ECDSA</a><ul><li><a href="#ecdsa-description">21.7.1. Description</a></li><li><a href="#ecdsa-registration">21.7.2. Registration</a></li><li><a href="#EcdsaParams-dictionary">21.7.3. EcdsaParams dictionary</a></li><li><a href="#EcKeyGenParams-dictionary">21.7.4. EcKeyGenParams dictionary</a></li><li><a href="#ecdsa-operations">21.7.5. Operations</a></li></ul></li><li><a href="#ecdh">21.8. ECDH</a><ul><li><a href="#ecdh-description">21.8.1. Description</a></li><li><a href="#ecdh-registration">21.8.2. Registration</a></li><li><a href="#dh-EcdhKeyDeriveParams">21.8.3. EcdhKeyDeriveParams dictionary</a></li><li><a href="#ecdh-operations">21.8.4. Operations</a></li></ul></li><li><a href="#aes-ctr">21.9. AES-CTR</a><ul><li><a href="#aes-ctr-description">21.9.1. Description</a></li><li><a href="#aes-ctr-registration">21.9.2. Registration</a></li><li><a href="#aes-ctr-params">21.9.3. AesCtrParams dictionary</a></li><li><a href="#aes-keygen-params">21.9.4. AesKeyGenParams dictionary</a></li><li><a href="#aes-ctr-operations">21.9.5. Operations</a></li></ul></li><li><a href="#aes-cbc">21.10. AES-CBC</a><ul><li><a href="#aes-cbc-description">21.10.1. Description</a></li><li><a href="#aes-cbc-registration">21.10.2. Registration</a></li><li><a href="#aes-cbc-params">21.10.3. AesCbcParams dictionary</a></li><li><a href="#aes-cbc-operations">21.10.4. Operations</a></li></ul></li><li><a href="#aes-gcm">21.11. AES-GCM</a><ul><li><a href="#aes-gcm-description">21.11.1. Description</a></li><li><a href="#aes-gcm-registration">21.11.2. Registration</a></li><li><a href="#aes-gcm-params">21.11.3. AesGcmParams dictionary</a></li><li><a href="#aes-gcm-operations">21.11.4. Operations</a></li></ul></li><li><a href="#hmac">21.12. HMAC</a><ul><li><a href="#hmac-description">21.12.1. Description</a></li><li><a href="#hmac-registration">21.12.2. Registration</a></li><li><a href="#hmac-params">21.12.3. HmacParams dictionary</a></li><li><a href="#hmac-operations">21.12.4. Operations</a></li></ul></li><li><a href="#dh">21.13. Diffie-Hellman</a><ul><li><a href="#dh-description">21.13.1. Description</a></li><li><a href="#dh-registration">21.13.2. Registration</a></li><li><a href="#dh-DhKeyGenParams">21.13.3. DhKeyGenParams dictionary</a></li><li><a href="#dh-DhKeyDeriveParams">21.13.4. DhKeyDeriveParams dictionary</a></li><li><a href="#dh-operations">21.13.5. Operations</a></li></ul></li><li><a href="#sha">21.14. SHA</a><ul><li><a href="#sha-description">21.14.1. Description</a></li><li><a href="#sha-registration">21.14.2. Registration</a></li><li><a href="#sha-operations">21.14.3. Operations</a></li></ul></li><li><a href="#concatkdf">21.15. Concat KDF</a><ul><li><a href="#concatkdf-description">21.15.1. Description</a></li><li><a href="#concatkdf-registration">21.15.2. Registration</a></li><li><a href="#concat-params">21.15.3. ConcatParams dictionary</a></li><li><a href="#concat-operations">21.15.4. Operations</a></li></ul></li><li><a href="#pbkdf2">21.16. PBKDF2</a><ul><li><a href="#pbkdf2-description">21.16.1. Description</a></li><li><a href="#pbkdf2-registration">21.16.2. Registration</a></li><li><a href="#pbkdf2-params">21.16.3. Pbkdf2Params dictionary</a></li><li><a href="#pbkdf2-operations">21.16.4. Operations</a></li></ul></li></ul></li><li><a href="#algorithm-normalizing-rules">22. Algorithm normalizing rules</a></li><li><a href="#examples-section">23. JavaScript Example Code</a><ul><li><a href="#examples-signing">23.1. Generate a signing key pair, sign some data</a></li><li><a href="#examples-symmetric-encryption">23.2. Symmetric Encryption</a></li></ul></li><li><a href="#acknowledgements-section">24. Acknowledgements</a></li><li><a href="#references">25. References</a><ul><li><a href="#normative-references">25.1. Normative References</a></li><li><a href="#informative-references">25.2. Informative References</a></li></ul></li></ul></div>
+      <div class="toc"><ul><li><a href="#introduction">1. Introduction</a></li><li><a href="#use-cases">2. Use Cases</a><ul><li><a href="#multifactor-authentication">2.1. Multi-factor Authentication</a></li><li><a href="#protected-document">2.2. Protected Document Exchange</a></li><li><a href="#cloud-storage">2.3. Cloud Storage</a></li><li><a href="#document-signing">2.4. Document Signing</a></li><li><a href="#data-integrity-protection">2.5. Data Integrity Protection</a></li><li><a href="#secure-messaging">2.6. Secure Messaging</a></li><li><a href="#jose">2.7. Javascript Object Signing and Encryption (JOSE)</a></li></ul></li><li><a href="#conformance">3. Conformance</a></li><li><a href="#scope">4. Scope</a><ul><li><a href="#scope-abstraction">4.1. Level of abstraction</a></li><li><a href="#scope-algorithms">4.2. Cryptographic algorithms</a></li><li><a href="#scope-operations">4.3. Operations</a></li><li><a href="#scope-out-of-scope">4.4. Out of scope</a></li></ul></li><li><a href="#security">5. Security considerations</a><ul><li><a href="#security-implementers">5.1. Security considerations for implementers</a></li><li><a href="#security-developers">5.2. Security considerations for developers</a></li></ul></li><li><a href="#privacy">6. Privacy considerations</a></li><li><a href="#dependencies">7. Dependencies</a></li><li><a href="#terminology">8. Terminology</a></li><li><a href="#RandomSource-interface">9. RandomSource interface</a><ul><li><a href="#RandomSource-description">9.1. Description</a></li><li><a href="#RandomSource-interface-methods">9.2. Methods and Parameters</a><ul><li><a href="#RandomSource-method-getRandomValues">9.2.1. The getRandomValues method</a></li></ul></li></ul></li><li><a href="#algorithm-dictionary">10. Algorithm dictionary</a><ul><li><a href="#algorithm-dictionary-members">10.1. Algorithm Dictionary Members</a></li></ul></li><li><a href="#key-interface">11. Key interface</a><ul><li><a href="#key-interface-description">11.1. Description</a></li><li><a href="#key-interface-members">11.2. Key interface members</a></li><li><a href="#key-interface-clone">11.3. Structured clone algorithm</a></li></ul></li><li><a href="#cryptooperation-interface">12. CryptoOperation interface</a><ul><li><a href="#CryptoOperation-processing-model">12.1. Processing Model</a></li><li><a href="#cryptooperation-events">12.2. Event Handler Attributes</a></li><li><a href="#CryptoOperation-attributes">12.3. Attributes</a></li><li><a href="#CryptoOperation-methods">12.4. Methods</a><ul><li><a href="#CryptoOperation-method-process">12.4.1. process(ArrayBufferView data)</a></li><li><a href="#CryptoOperation-method-finish">12.4.2. The finish() method</a></li><li><a href="#CryptoOperation-method-abort">12.4.3. The abort() method</a></li></ul></li></ul></li><li><a href="#KeyOperation-interface">13. KeyOperation interface</a></li><li><a href="#crypto-interface">14. Crypto interface</a><ul><li><a href="#crypto-interface-methods">14.1. Methods and Parameters</a><ul><li><a href="#Crypto-method-encrypt">14.1.1. The encrypt method</a></li><li><a href="#Crypto-method-decrypt">14.1.2. The decrypt method</a></li><li><a href="#Crypto-method-sign">14.1.3. The sign method</a></li><li><a href="#Crypto-method-verify">14.1.4. The verify method</a></li><li><a href="#Crypto-method-digest">14.1.5. The digest method</a></li><li><a href="#Crypto-method-generateKey">14.1.6. The generateKey method</a></li><li><a href="#Crypto-method-deriveKey">14.1.7. The deriveKey method</a></li><li><a href="#Crypto-method-importKey">14.1.8. The importKey method</a></li><li><a href="#Crypto-method-exportKey">14.1.9. The exportKey method</a></li></ul></li></ul></li><li><a href="#WorkerCrypto-interface">15. WorkerCrypto interface</a><ul><li><a href="#WorkerCrypto-description">15.1. Description</a></li></ul></li><li><a href="#big-integer">16. BigInteger</a></li><li><a href="#keypair">17. KeyPair</a></li><li><a href="#key-discovery">18. Key Discovery</a></li><li><a href="#algorithms">19. Algorithms</a><ul><li><a href="#recommended-algorithms">19.1. Recommended algorithms</a></li><li><a href="#defining-an-algorithm">19.2. Defining an algorithm</a><ul><li><a href="#recognized-algorithm-name">19.2.1. Recognized algorithm name</a></li><li><a href="#supported-operations">19.2.2. Supported operations</a></li><li><a href="#algorithm-specific-params">19.2.3. Algorithm-specific parameters</a></li><li><a href="#algorithm-result">19.2.4. Algorithm results</a></li><li><a href="#algorithm-alias">19.2.5. Algorithm aliases</a></li></ul></li><li><a href="#rsaes-pkcs1">19.3. RSAES-PKCS1-v1_5</a><ul><li><a href="#rsaes-pkcs1-description">19.3.1. Description</a></li><li><a href="#rsaes-pkcs1-registration">19.3.2. Registration</a></li><li><a href="#RsaKeyGenParams-dictionary">19.3.3. RsaKeyGenParams dictionary</a></li><li><a href="#rsaes-pkcs1-operations">19.3.4. Operations</a></li></ul></li><li><a href="#rsassa-pkcs1">19.4. RSASSA-PKCS1-v1_5</a><ul><li><a href="#rsassa-pkcs1-description">19.4.1. Description</a></li><li><a href="#rsassa-pkcs1-registration">19.4.2. Registration</a></li><li><a href="#RsaSsaParams-dictionary">19.4.3. RsaSsaParams dictionary</a></li><li><a href="#rsassa-pkcs1-operations">19.4.4. Operations</a></li></ul></li><li><a href="#rsa-pss">19.5. RSA-PSS</a><ul><li><a href="#rsa-pss-description">19.5.1. Description</a></li><li><a href="#rsa-pss-registration">19.5.2. Registration</a></li><li><a href="#rsa-pss-params">19.5.3. RsaPssParams dictionary</a></li><li><a href="#rsa-pss-operations">19.5.4. Operations</a></li></ul></li><li><a href="#rsa-oaep">19.6. RSA-OAEP</a><ul><li><a href="#rsa-oaep-description">19.6.1. Description</a></li><li><a href="#rsa-oaep-registration">19.6.2. Registration</a></li><li><a href="#rsa-oaep-params">19.6.3. RsaOaepParams dictionary</a></li><li><a href="#rsa-oaep-operations">19.6.4. Operations</a></li></ul></li><li><a href="#ecdsa">19.7. ECDSA</a><ul><li><a href="#ecdsa-description">19.7.1. Description</a></li><li><a href="#ecdsa-registration">19.7.2. Registration</a></li><li><a href="#EcdsaParams-dictionary">19.7.3. EcdsaParams dictionary</a></li><li><a href="#EcKeyGenParams-dictionary">19.7.4. EcKeyGenParams dictionary</a></li><li><a href="#ecdsa-operations">19.7.5. Operations</a></li></ul></li><li><a href="#ecdh">19.8. ECDH</a><ul><li><a href="#ecdh-description">19.8.1. Description</a></li><li><a href="#ecdh-registration">19.8.2. Registration</a></li><li><a href="#dh-EcdhKeyDeriveParams">19.8.3. EcdhKeyDeriveParams dictionary</a></li><li><a href="#ecdh-operations">19.8.4. Operations</a></li></ul></li><li><a href="#aes-ctr">19.9. AES-CTR</a><ul><li><a href="#aes-ctr-description">19.9.1. Description</a></li><li><a href="#aes-ctr-registration">19.9.2. Registration</a></li><li><a href="#aes-ctr-params">19.9.3. AesCtrParams dictionary</a></li><li><a href="#aes-keygen-params">19.9.4. AesKeyGenParams dictionary</a></li><li><a href="#aes-ctr-operations">19.9.5. Operations</a></li></ul></li><li><a href="#aes-cbc">19.10. AES-CBC</a><ul><li><a href="#aes-cbc-description">19.10.1. Description</a></li><li><a href="#aes-cbc-registration">19.10.2. Registration</a></li><li><a href="#aes-cbc-params">19.10.3. AesCbcParams dictionary</a></li><li><a href="#aes-cbc-operations">19.10.4. Operations</a></li></ul></li><li><a href="#aes-gcm">19.11. AES-GCM</a><ul><li><a href="#aes-gcm-description">19.11.1. Description</a></li><li><a href="#aes-gcm-registration">19.11.2. Registration</a></li><li><a href="#aes-gcm-params">19.11.3. AesGcmParams dictionary</a></li><li><a href="#aes-gcm-operations">19.11.4. Operations</a></li></ul></li><li><a href="#hmac">19.12. HMAC</a><ul><li><a href="#hmac-description">19.12.1. Description</a></li><li><a href="#hmac-registration">19.12.2. Registration</a></li><li><a href="#hmac-params">19.12.3. HmacParams dictionary</a></li><li><a href="#hmac-operations">19.12.4. Operations</a></li></ul></li><li><a href="#dh">19.13. Diffie-Hellman</a><ul><li><a href="#dh-description">19.13.1. Description</a></li><li><a href="#dh-registration">19.13.2. Registration</a></li><li><a href="#dh-DhKeyGenParams">19.13.3. DhKeyGenParams dictionary</a></li><li><a href="#dh-DhKeyDeriveParams">19.13.4. DhKeyDeriveParams dictionary</a></li><li><a href="#dh-operations">19.13.5. Operations</a></li></ul></li><li><a href="#sha">19.14. SHA</a><ul><li><a href="#sha-description">19.14.1. Description</a></li><li><a href="#sha-registration">19.14.2. Registration</a></li><li><a href="#sha-operations">19.14.3. Operations</a></li></ul></li><li><a href="#concatkdf">19.15. Concat KDF</a><ul><li><a href="#concatkdf-description">19.15.1. Description</a></li><li><a href="#concatkdf-registration">19.15.2. Registration</a></li><li><a href="#concat-params">19.15.3. ConcatParams dictionary</a></li><li><a href="#concat-operations">19.15.4. Operations</a></li></ul></li><li><a href="#pbkdf2">19.16. PBKDF2</a><ul><li><a href="#pbkdf2-description">19.16.1. Description</a></li><li><a href="#pbkdf2-registration">19.16.2. Registration</a></li><li><a href="#pbkdf2-params">19.16.3. Pbkdf2Params dictionary</a></li><li><a href="#pbkdf2-operations">19.16.4. Operations</a></li></ul></li></ul></li><li><a href="#algorithm-normalizing-rules">20. Algorithm normalizing rules</a></li><li><a href="#examples-section">21. JavaScript Example Code</a><ul><li><a href="#examples-signing">21.1. Generate a signing key pair, sign some data</a></li><li><a href="#examples-symmetric-encryption">21.2. Symmetric Encryption</a></li></ul></li><li><a href="#acknowledgements-section">22. Acknowledgements</a></li><li><a href="#references">23. References</a><ul><li><a href="#normative-references">23.1. Normative References</a></li><li><a href="#informative-references">23.2. Informative References</a></li></ul></li></ul></div>
     </div>
 
     <div id="sections">
@@ -588,7 +588,8 @@
           <dfn id="dfn-task">task</dfn>,
           <dfn id="task-source">task source</dfn>,
           <dfn id="df-URL">URL</dfn>,
-          <dfn id="queue-a-task">queue a task</dfn>, and
+          <dfn id="queue-a-task">queue a task</dfn>,
+          <dfn id="fire-a-simple-event">fire a simple event</dfn>, and
           <dfn id="structured-clone">structured clone</dfn>,
           are defined by the HTML specification [<a href="#HTML">HTML</a>].
         </p>
@@ -834,8 +835,8 @@
               <ul>
                 <li><a href="#dfn-Key-type">type</a></li>
                 <li><a href="#dfn-Key-extractable">extractable</a></li>
-                <li><a href="#dfn-Key-Algorithm">Algorithm</a></li>
-                <li><a href="#dfn-Key-KeyUsage">KeyUsage</a></li>
+                <li><a href="#dfn-Key-algorithm">Algorithm</a></li>
+                <li><a href="#dfn-Key-keyUsage">KeyUsage</a></li>
               </ul>
             </li>
             <li>
@@ -1072,7 +1073,8 @@
             </li>
             <li>
               <p>
-                <a href="#fire-a-simple-event">Fire an event</a> named <a href="#dfn-CryptoOperation-onprogress"><code>onprogress</code></a>
+                <a href="#fire-a-simple-event">fire a simple event</a> named
+                <a href="#dfn-CryptoOperation-onprogress"><code>onprogress</code></a>
                 at the <a href="#dfn-CryptoOperation"><code>CryptoOperation</code></a>.
               </p>
             </li>
@@ -1256,7 +1258,7 @@
                 <p>
                   Once all items in the <a href="#dfn-CryptoOperation-list-of-pending-data">list of pending data</a> have
                   been <a href="#dfn-CryptoOperation-process-data">processed</a>, <a href="#queue-a-task">queue a task</a>
-                  to <a href="#fire-a-simple-event">fire an event</a> called
+                  to <a href="#fire-a-simple-event">fire a simple event</a> called
                   <a href="#dfn-CryptoOperation-oncomplete"><code>oncomplete</code></a> at the
                   <a href="#dfn-CryptoOperation"><code>CryptoOperation</code></a>.
                 </p>
@@ -1285,12 +1287,16 @@
                 one of the task queues, then remove those tasks.
               </li>
               <li>
-                Fire an event called <a href="#dfn-onabort-event"><code>abort</code></a>.
+                <a href="#fire-a-simple-event">Fire a simple event</a> called
+                <a href="#dfn-onabort-event"><code>onabort</code></a> at the
+                <a href="#dfn-CryptoOperation"><code>CryptoOperation</code></a>.
               </li>
             </ol>
             <div class="ednote"><div class="ednoteHeader">Editorial note</div>
               <p>
-                The above algorithm is underspecified.
+                The above algorithm is underspecified, both for user agents that do not implement abortable processing and
+                because the <a href="#dfn-CryptoOperation-process-data">process data algorithm</a> does not define how
+                to abort midstream.
               </p>
             </div>
           </div>
@@ -1303,14 +1309,14 @@
 interface <dfn id="dfn-KeyOperation">KeyOperation</dfn> : EventTarget {
   readonly attribute any <a href="#dfn-KeyOperation-result">result</a>;
 
-  [TreatNonCallableAsNull] attribute Function? <a href="#dfn-KeyGenerator-onerror">onerror</a>;
-  [TreatNonCallableAsNull] attribute Function? <a href="#dfn-KeyGenerator-oncomplete">oncomplete</a>;
+  [TreatNonCallableAsNull] attribute Function? <a href="#dfn-KeyOperation-onerror">onerror</a>;
+  [TreatNonCallableAsNull] attribute Function? <a href="#dfn-KeyOperation-oncomplete">oncomplete</a>;
 };
         </code></pre></div></div>
       </div>
       
-      <div id="KeyImporter-interface" class="section">
-        <h2>14. KeyImporter interface</h2>
+      <div id="crypto-interface" class="section">
+        <h2>14. Crypto interface</h2>
         <div class="block"><div class="blockTitleDiv"><span class="blockTitle">IDL</span></div><div class="blockContent"><pre class="code"><code class="idl-code">
 enum <dfn id="dfn-KeyFormat">KeyFormat</dfn> {
   <span class="comment">// An unformatted sequence of bytes. Intended for secret keys.</span>
@@ -1323,24 +1329,6 @@
   "jwk",
 };
 
-interface <dfn id="dfn-KeyImporter">KeyImporter</dfn> : <a href="#dfn-KeyOperation">KeyOperation</a> {
-  readonly attribute <a href="#dfn-KeyFormat">KeyFormat</a> format;
-};
-        </code></pre></div></div>
-      </div>
-      
-      <div id="KeyExporter-interface" class="section">
-        <h2>15. KeyExporter interface</h2>
-        <div class="block"><div class="blockTitleDiv"><span class="blockTitle">IDL</span></div><div class="blockContent"><pre class="code"><code class="idl-code">
-interface <dfn id="dfn-KeyExporter">KeyExporter</dfn> : <a href="#dfn-KeyOperation">KeyOperation</a> {
-  readonly attribute <a href="#dfn-KeyFormat">KeyFormat</a> format;
-};
-        </code></pre></div></div>
-      </div>
-      
-      <div id="crypto-interface" class="section">
-        <h2>16. Crypto interface</h2>
-        <div class="block"><div class="blockTitleDiv"><span class="blockTitle">IDL</span></div><div class="blockContent"><pre class="code"><code class="idl-code">
 interface <dfn id="dfn-crypto">Crypto</dfn> {
   <a href="#dfn-CryptoOperation">CryptoOperation</a> <a href="#dfn-Crypto-method-encrypt">encrypt</a>(<a href="#dfn-AlgorithmIdentifier">AlgorithmIdentifier</a> algorithm, <a href="#dfn-Key">Key</a> key, optional ArrayBufferView? buffer = null);
   <a href="#dfn-CryptoOperation">CryptoOperation</a> <a href="#dfn-Crypto-method-decrypt">decrypt</a>(<a href="#dfn-AlgorithmIdentifier">AlgorithmIdentifier</a> algorithm, <a href="#dfn-Key">Key</a> key, optional ArrayBufferView? buffer = null);
@@ -1349,22 +1337,22 @@
   <a href="#dfn-CryptoOperation">CryptoOperation</a> <a href="#dfn-Crypto-method-digest">digest</a>(<a href="#dfn-AlgorithmIdentifier">AlgorithmIdentifier</a> algorithm, optional ArrayBufferView? buffer = null);
 
   <span class="comment">// TBD: <a href="https://www.w3.org/2012/webcrypto/track/issues/36">ISSUE-36</a></span>
-  <a href="#dfn-KeyGenerator">KeyGenerator</a> <a href="#dfn-Crypto-method-generateKey">generateKey</a>(<a href="#dfn-AlgorithmIdentifier">AlgorithmIdentifier</a> algorithm,
+  <a href="#dfn-KeyOperation">KeyOperation</a> <a href="#dfn-Crypto-method-generateKey">generateKey</a>(<a href="#dfn-AlgorithmIdentifier">AlgorithmIdentifier</a> algorithm,
                            bool extractable = false,
                            <a href="#dfn-KeyUsage">KeyUsage</a>[] keyUsages = []);
-  <a href="#dfn-KeyDeriver">KeyDeriver</a> <a href="#dfn-Crypto-method-deriveKey">deriveKey</a>(<a href="#dfn-AlgorithmIdentifier">AlgorithmIdentifier</a> algorithm,
+  <a href="#dfn-KeyOperation">KeyOperation</a> <a href="#dfn-Crypto-method-deriveKey">deriveKey</a>(<a href="#dfn-AlgorithmIdentifier">AlgorithmIdentifier</a> algorithm,
                          <a href="#dfn-Key">Key</a> baseKey,
                          <a href="#dfn-AlgorithmIdentifier">AlgorithmIdentifier</a>? derivedKeyType,
                          bool extractable = false,
                          <a href="#dfn-KeyUsage">KeyUsage</a>[] keyUsages = []);
   
   <span class="comment">// TBD: <a href="https://www.w3.org/2012/webcrypto/track/issues/35">ISSUE-35</a></span>
-  <a href="#dfn-KeyImporter">KeyImporter</a> <a href="#dfn-Crypto-method-importKey">importKey</a>(<a href="#dfn-KeyFormat">KeyFormat</a> format,
-                         ArrayBufferView key,
+  <a href="#dfn-KeyOperation">KeyOperation</a> <a href="#dfn-Crypto-method-importKey">importKey</a>(<a href="#dfn-KeyFormat">KeyFormat</a> format,
+                         ArrayBufferView keyData,
                          <a href="#dfn-AlgorithmIdentifier">AlgorithmIdentifier</a>? algorithm,
                          bool extractable = false,
                          <a href="#dfn-KeyUsage">KeyUsage</a>[] keyUsages = []);
-  <a href="#dfn-KeyExporter">KeyExporter</a> <a href="#dfn-Crypto-method-exportKey">exportKey</a>(<a href="#dfn-KeyFormat">KeyFormat</a> format, <a href="#dfn-Key">Key</a> key);
+  <a href="#dfn-KeyOperation">KeyOperation</a> <a href="#dfn-Crypto-method-exportKey">exportKey</a>(<a href="#dfn-KeyFormat">KeyFormat</a> format, <a href="#dfn-Key">Key</a> key);
 };
 
 <a href="#dfn-Crypto">Crypto</a> implements <a href="#dfn-RandomSource">RandomSource</a>;
@@ -1392,9 +1380,9 @@
           </ul>
         </div>
         <div id="crypto-interface-methods" class="section">
-          <h3>16.1. Methods and Parameters</h3>
+          <h3>14.1. Methods and Parameters</h3>
           <div id="Crypto-method-encrypt" class="section">
-            <h4>16.1.1. The encrypt method</h4>
+            <h4>14.1.1. The encrypt method</h4>
             <p>
               The <dfn id="dfn-Crypto-method-encrypt"><code>encrypt</code></dfn>
               method returns a new <a href="#dfn-CryptoOperation"><code>CryptoOperation</code></a>
@@ -1496,7 +1484,7 @@
           </div>
 
           <div id="Crypto-method-decrypt" class="section">
-            <h4>16.1.2. The decrypt method</h4>
+            <h4>14.1.2. The decrypt method</h4>
             <p>
               The <dfn id="dfn-Crypto-method-decrypt"><code>decrypt</code></dfn>
               method returns a new <a href="#dfn-CryptoOperation"><code>CryptoOperation</code></a>
@@ -1598,7 +1586,7 @@
           </div>
 
           <div id="Crypto-method-sign" class="section">
-            <h4>16.1.3. The sign method</h4>
+            <h4>14.1.3. The sign method</h4>
             <p>
               The <dfn id="dfn-Crypto-method-sign"><code>sign</code></dfn> method
               returns a new <a href="#dfn-CryptoOperation"><code>CryptoOperation</code></a>
@@ -1699,7 +1687,7 @@
           </div>
 
           <div id="Crypto-method-verify" class="section">
-            <h4>16.1.4. The verify method</h4>
+            <h4>14.1.4. The verify method</h4>
             <p>
               The <dfn id="dfn-Crypto-method-verify"><code>verify</code></dfn> method
               returns a new <a href="#dfn-CryptoOperation"><code>CryptoOperation</code></a>
@@ -1800,7 +1788,7 @@
           </div>
 
           <div id="Crypto-method-digest" class="section">
-            <h4>16.1.5. The digest method</h4>
+            <h4>14.1.5. The digest method</h4>
             <p>
               The <dfn id="dfn-Crypto-method-digest"><code>digest</code></dfn> method returns
               a new <a href="#dfn-CryptoOperation"><code>CryptoOperation</code></a>
@@ -1901,29 +1889,220 @@
           </div>
 
           <div id="Crypto-method-generateKey" class="section">
-            <h4>16.1.6. The generateKey method</h4>
+            <h4>14.1.6. The generateKey method</h4>
             <p>
+              When invoked, this method <span class="RFC2119">MUST</span> perform the following steps:
             </p>
+            <ol>
+              <li>
+                <p>
+                  Let <var>normalizedAlgorithm</var> be the result of processing
+                  <code>algorithm</code> according to the
+                  <a href="#algorithm-normalizing-rules">algorithm normalizing rules</a>.
+                </p>
+              </li>
+              <li>
+                <p>
+                  If <var>normalizedAlgorithm</var> does not describe a
+                  <a href="#algorithms">registered algorithm</a> that supports the generate
+                  operation, throw a <code>NotSupportedError</code> and
+                  <dfn id="terminate-the-algorithm">terminate the algorithm</dfn>.
+                </p>
+              </li>
+              <li>
+                <p>
+                  Let <var>keyOp</var> be a newly created object implementing the
+                  <a href="#dfn-KeyOperation"><code>KeyOperation</code></a> interface.
+                </p>
+              </li>
+              <li>
+                <p>
+                  Return <var>keyOp</var> to the task that invoked this <code>generateKey</code>, while
+                  continuing the remaining steps of this algorithm.
+                </p>
+              </li>
+              <li>
+                <p>
+                  Queue up an operation to run the following steps:
+                </p>
+                <ol>
+                  <li>
+                  </li>
+                  <li>
+                    <p>
+                      Invoke the algorithm-specific key generation method.
+                    </p>
+                  </li>
+                  <li>
+                    <p>
+                      If an error occured, <a href="#queue-a-task">queue a task</a> to
+                      <a href="#fire-a-simple-event">fire a simple event</a>
+                      called <a href="#dfn-KeyOperation-onerror"><code>onerror</code></a> at
+                      <var>KeyOp</var> and terminate this algorithm.
+                    </p>
+                  </li>
+                  <li>
+                    <p>
+                      Otherwise, if the algorithm-specific key generation method completed successfully,
+                      let <var>result</var> be the result of that operation.
+                    </p>
+                  </li>
+                  <li>
+                    <p>
+                      Set <var>keyOp</var>.<a href="#dfn-KeyOperation-result"><code>result</code></a> =
+                      <var>result</var>
+                    </p>
+                  </li>
+                  <li>
+                    <p>
+                      <a href="#queue-a-task">Queue a task</a> to
+                      <a href="#fire-a-simple-event">fire a simple event</a> called
+                      <a href="#dfn-KeyOperation-oncomplete"><code>oncomplete</code></a> at
+                      <var>KeyOp</var>
+                    </p>
+                  </li>
+                </ol>
+              </li>
+            </ol>
             <div class="ednote"><div class="ednoteHeader">Editorial note</div>
               <ul>
                 <li>
-                  <a href="https://www.w3.org/2012/webcrypto/track/issues/16">ISSUE-16</a>:
-                  Should callers be able to specify key lifetime?
+                  <p>
+                    The handling for <var>extractable</var> and <var>keyUsages</var> are currently
+                    underspecified. The <em>intent</em> is that any derived secret/private keys will
+                    reflect whatever the caller specified. However, the exact wording of how to specify
+                    that remains TBD.
+                  </p>
+                  <p>
+                    Consider, for example, generation of an RSA key pair. The intent may be that the public
+                    key has the "verify" usage, and the private key has the "sign" usage, but there is no
+                    way in the API to specify that. The same concern applies for "encrypt" and "decrypt".
+                  </p>
+                  <p>
+                    An alternative would be to allow the caller to write to the attributes on individual
+                    <a href="#dfn-Key"><code>Key</code></a> objects themselves, after generation, and then
+                    have some operation to finalize the object itself, but this as well remains TBD.
+                  </p>
                 </li>
               </ul>
             </div>
           </div>
           
           <div id="Crypto-method-deriveKey" class="section">
-            <h4>16.1.7. The deriveKey method</h4>
-            <p></p>
+            <h4>14.1.7. The deriveKey method</h4>
+            <p>
+              When invoked, this method <span class="RFC2119">MUST</span> perform the following steps:
+            </p>
+            <ol>
+              <li>
+                <p>
+                  Let <var>normalizedAlgorithm</var> be the result of processing
+                  <code>algorithm</code> according to the
+                  <a href="#algorithm-normalizing-rules">algorithm normalizing rules</a>.
+                </p>
+              </li>
+              <li>
+                <p>
+                  If <var>normalizedAlgorithm</var> does not describe a
+                  <a href="#algorithms">registered algorithm</a> that supports the derive
+                  operation, throw a <code>NotSupportedError</code> and
+                  <dfn id="terminate-the-algorithm">terminate the algorithm</dfn>.
+                </p>
+              </li>
+              <li>
+                <p>
+                  Let <var>keyOp</var> be a newly created object implementing the
+                  <a href="#dfn-KeyOperation"><code>KeyOperation</code></a> interface.
+                </p>
+              </li>
+              <li>
+                <p>
+                  Return <var>keyOp</var> to the task that invoked this <code>generateKey</code>, while
+                  continuing the remaining steps of this algorithm.
+                </p>
+              </li>
+              <li>
+                <p>
+                  Queue up an operation to run the following steps:
+                </p>
+                <ol>
+                  <li>
+                    <p>
+                      If <var>baseKey</var>.<a href="#dfn-Key-keyUsage"><code>keyUsage</code></a> does not
+                      contain the <code>"derive"</code> <a href="#dfn-KeyUsage"><code>KeyUsage</code></a>,
+                      <a href="#queue-a-task">queue a task</a> to
+                      <a href="#fire-a-simple-event">fire a simple event</a>
+                      called <a href="#dfn-KeyOperation-onerror"><code>onerror</code></a> at
+                      <var>KeyOp</var> and terminate this algorithm.
+                    </p>
+                  </li>
+                  <li>
+                    <p>
+                      Invoke the algorithm-specific key generation method.
+                    </p>
+                  </li>
+                  <li>
+                    <p>
+                      If an error occured, <a href="#queue-a-task">queue a task</a> to
+                      <a href="#fire-a-simple-event">fire a simple event</a>
+                      called <a href="#dfn-KeyOperation-onerror"><code>onerror</code></a> at
+                      <var>KeyOp</var> and terminate this algorithm.
+                    </p>
+                  </li>
+                  <li>
+                    <p>
+                      Otherwise, if the algorithm-specific key derivation method completed successfully,
+                      let <var>result</var> be the result of that operation.
+                    </p>
+                  </li>
+                  <li>
+                    <p>
+                      Set <var>keyOp</var>.<a href="#dfn-KeyOperation-result"><code>result</code></a> =
+                      <var>result</var>
+                    </p>
+                  </li>
+                  <li>
+                    <p>
+                      <a href="#queue-a-task">Queue a task</a> to
+                      <a href="#fire-a-simple-event">fire a simple event</a> called
+                      <a href="#dfn-KeyOperation-oncomplete"><code>oncomplete</code></a> at
+                      <var>KeyOp</var>
+                    </p>
+                  </li>
+                </ol>
+              </li>
+            </ol>
+            <div class="ednote"><div class="ednoteHeader">Editorial note</div>
+              <ul>
+                <li>
+                  <p>
+                    The handling for <var>extractable</var> and <var>keyUsages</var> are currently
+                    underspecified. The <em>intent</em> is that any derived secret/private keys will
+                    reflect whatever the caller specified. However, the exact wording of how to specify
+                    that remains TBD.
+                  </p>
+                  <p>
+                    Consider, for example, when derivation results in multiple key handles. The intent
+                    may be that one <code>Key</code> object is used for <code>encrypt</code>ing, while
+                    another is used for <code>decrypt</code>ing. However, the current way of specifying
+                    <code>KeyUsage</code> does not provide a means for callers to do so.
+                  </p>
+                  <p>
+                    An alternative would be to allow the caller to write to the attributes on individual
+                    <a href="#dfn-Key"><code>Key</code></a> objects themselves, after generation, and then
+                    have some operation to finalize the object itself, but this as well remains TBD.
+                  </p>
+                </li>
+              </ul>
+            </div>
           </div>
+
           <div id="Crypto-method-importKey" class="section">
-            <h4>16.1.8. The importKey method</h4>
+            <h4>14.1.8. The importKey method</h4>
             <p></p>
           </div>
           <div id="Crypto-method-exportKey" class="section">
-            <h4>16.1.9. The exportKey method</h4>
+            <h4>14.1.9. The exportKey method</h4>
             <p></p>
           </div>
           
@@ -1931,7 +2110,7 @@
       </div>
 
       <div id="WorkerCrypto-interface" class="section">
-        <h2>17. WorkerCrypto interface</h2>
+        <h2>15. WorkerCrypto interface</h2>
         <div class="block"><div class="blockTitleDiv"><span class="blockTitle">IDL</span></div><div class="blockContent"><pre class="code"><code class="idl-code">
 interface WorkerCrypto {
 };
@@ -1943,7 +2122,7 @@
 };
         </code></pre></div></div>
         <div id="WorkerCrypto-description" class="section">
-          <h3>17.1. Description</h3>
+          <h3>15.1. Description</h3>
           <p>
             The <a href="#dfn-WorkerCrypto">WorkerCrypto</a> interface provides cryptographic
             functionality for background scripts, as specified by Web Workers [
@@ -1961,7 +2140,7 @@
       </div>
 
       <div id="big-integer" class="section">
-        <h2>18. BigInteger</h2>
+        <h2>16. BigInteger</h2>
         <div class="block"><div class="blockTitleDiv"><span class="blockTitle">IDL</span></div><div class="blockContent"><pre class="code"><code class="idl-code">
 typedef Uint8Array <dfn id="dfn-BigInteger">BigInteger</dfn>;
         </code></pre></div></div>
@@ -1976,7 +2155,7 @@
       </div>
       
       <div id="keypair" class="section">
-        <h2>19. KeyPair</h2>
+        <h2>17. KeyPair</h2>
         <div class="block"><div class="blockTitleDiv"><span class="blockTitle">IDL</span></div><div class="blockContent"><pre class="code"><code class="idl-code">
 interface <dfn id="dfn-KeyPair">KeyPair</dfn> {
   <a href="#dfn-Key">Key</a> publicKey;
@@ -1990,7 +2169,7 @@
       </div>
 
       <div id="key-discovery" class="section">
-        <h2>20. Key Discovery</h2>
+        <h2>18. Key Discovery</h2>
         <p class="norm">This section is non-normative.</p>
         <div class="ednote"><div class="ednoteHeader">Editorial note</div>
           <p>
@@ -2033,9 +2212,9 @@
       </div>
 
       <div id="algorithms" class="section">
-        <h2>21. Algorithms</h2>
+        <h2>19. Algorithms</h2>
         <div id="recommended-algorithms" class="section">
-          <h3>21.1. Recommended algorithms</h3>
+          <h3>19.1. Recommended algorithms</h3>
           <p class="norm">This section is non-normative</p>
           <p>
             As the API is meant to be extensible in order to keep up with future developments within
@@ -2058,7 +2237,7 @@
           </p>
         </div>
         <div id="defining-an-algorithm" class="section">
-          <h3>21.2. Defining an algorithm</h3>
+          <h3>19.2. Defining an algorithm</h3>
           <p>
             Each algorithm that is to be exposed via the Web Cryptography API
             <span class="RFC2119">SHOULD</span> be registered via the Web Cryptography working group,
@@ -2067,7 +2246,7 @@
             <span class="RFC2119">MUST</span> be processed as if the sections had been defined.
           </p>
           <div id="recognized-algorithm-name" class="section">
-            <h4>21.2.1. Recognized algorithm name</h4>
+            <h4>19.2.1. Recognized algorithm name</h4>
             <p>
               Each registered algorithm <span class="RFC2119">MUST</span> have a canonical name
               for which applications can refer to the algorithm. The canonical name
@@ -2078,14 +2257,14 @@
             </p>
           </div>
           <div id="supported-operations" class="section">
-            <h4>21.2.2. Supported operations</h4>
+            <h4>19.2.2. Supported operations</h4>
             <p>
               Each registered algorithm <span class="RFC2119">MUST</span> define the operations
               that it supports.
             </p>
           </div>
           <div id="algorithm-specific-params" class="section">
-            <h4>21.2.3. Algorithm-specific parameters</h4>
+            <h4>19.2.3. Algorithm-specific parameters</h4>
             <p>
               Each registered algorithm <span class="RFC2119">MUST</span> define the expected
               contents of the <a href="#dfn-Algorithm-params"><code>params</code></a> member of
@@ -2100,7 +2279,7 @@
             </p>
           </div>
           <div id="algorithm-result" class="section">
-            <h4>21.2.4. Algorithm results</h4>
+            <h4>19.2.4. Algorithm results</h4>
             <p>
               Each registered algorithm <span class="RFC2119">MUST</span> define the contents
               of the <a href="#dfn-CryptoOperation-result"><code>result</code></a> attribute of the
@@ -2110,7 +2289,7 @@
             </p>
           </div>
           <div id="algorithm-alias" class="section">
-            <h4>21.2.5. <dfn id="dfn-algorithm-alias">Algorithm aliases</dfn></h4>
+            <h4>19.2.5. <dfn id="dfn-algorithm-alias">Algorithm aliases</dfn></h4>
             <p>
               Each registered algorithm <span class="RFC2119">MAY</span> define one or more aliases
               that may define a fully normalized <a href="#dfn-Algorithm">Algorithm</a> object.
@@ -2133,9 +2312,9 @@
         </div>
 
         <div id="rsaes-pkcs1" class="section">
-          <h3>21.3. RSAES-PKCS1-v1_5</h3>
+          <h3>19.3. RSAES-PKCS1-v1_5</h3>
           <div id="rsaes-pkcs1-description" class="section">
-            <h4>21.3.1. Description</h4>
+            <h4>19.3.1. Description</h4>
             <p>
               The <code>"RSAES-PKCS1-v1_5"</code> algorithm identifier is used to perform encryption
               and decryption ordering to the RSAES-PKCS1-v1_5 algorithm specified in
@@ -2143,7 +2322,7 @@
             </p>
           </div>
           <div id="rsaes-pkcs1-registration" class="section">
-            <h4>21.3.2. Registration</h4>
+            <h4>19.3.2. Registration</h4>
             <p>
               The <a href="#recognized-algorithm-name">recognized algorithm name</a> for
               this algorithm is <code>"RSAES-PKCS1-v1_5"</code>.
@@ -2176,7 +2355,7 @@
             </table>
           </div>
           <div id="RsaKeyGenParams-dictionary" class="section">
-            <h4>21.3.3. RsaKeyGenParams dictionary</h4>
+            <h4>19.3.3. RsaKeyGenParams dictionary</h4>
             <div class="block"><div class="blockTitleDiv"><span class="blockTitle">IDL</span></div><div class="blockContent"><pre class="code"><code class="idl-code">
 dictionary <dfn id="dfn-RsaKeyGenParams">RsaKeyGenParams</dfn> : <a href="#dfn-AlgorithmParameters">AlgorithmParameters</a> {
   <span class="comment">// The length, in bits, of the RSA modulus</span>
@@ -2187,7 +2366,7 @@
             </code></pre></div></div>
           </div>
           <div id="rsaes-pkcs1-operations" class="section">
-            <h4>21.3.4. Operations</h4>
+            <h4>19.3.4. Operations</h4>
             <dl>
               <dt>Encrypt</dt>
               <dd>
@@ -2309,17 +2488,15 @@
               </dd>
               <dt>Generate Key</dt>
               <dd>
-                When generating a key pair, the resultant <code><a href="#dfn-KeyGenerator">KeyGenerator</a></code>
-                shall behave as follows:
               </dd>
             </dl>
           </div>
         </div>
 
         <div id="rsassa-pkcs1" class="section">
-          <h3>21.4. RSASSA-PKCS1-v1_5</h3>
+          <h3>19.4. RSASSA-PKCS1-v1_5</h3>
           <div id="rsassa-pkcs1-description" class="section">
-            <h4>21.4.1. Description</h4>
+            <h4>19.4.1. Description</h4>
             <p>
               The <code>"RSASSA-PKCS1-v1_5"</code> algorithm identifier is used to perform
               signing and verification using the RSASSA-PKCS1-v1_5 algorithm specified in
@@ -2327,7 +2504,7 @@
             </p>
           </div>
           <div id="rsassa-pkcs1-registration" class="section">
-            <h4>21.4.2. Registration</h4>
+            <h4>19.4.2. Registration</h4>
             <p>
               The <a href="#recognized-algorithm-name">recognized algorithm name</a> for
               this algorithm is <code>"RSASSA-PKCS1-v1_5"</code>.
@@ -2360,7 +2537,7 @@
             </table>
           </div>
           <div id="RsaSsaParams-dictionary" class="section">
-            <h4>21.4.3. RsaSsaParams dictionary</h4>
+            <h4>19.4.3. RsaSsaParams dictionary</h4>
             <div class="block"><div class="blockTitleDiv"><span class="blockTitle">IDL</span></div><div class="blockContent"><pre class="code"><code class="idl-code">
 dictionary <dfn id="dfn-RsaSsaParams">RsaSsaParams</dfn> : <a href="#dfn-AlgorithmParameters">AlgorithmParameters</a> {
   <span class="comment">// The hash algorithm to use</span> 
@@ -2369,7 +2546,7 @@
             </code></pre></div></div>
           </div>
           <div id="rsassa-pkcs1-operations" class="section">
-            <h4>21.4.4. Operations</h4>
+            <h4>19.4.4. Operations</h4>
             <ul>
               <li>Sign</li>
               <li>Verify</li>
@@ -2379,9 +2556,9 @@
         </div>
 
         <div id="rsa-pss" class="section">
-          <h3>21.5. RSA-PSS</h3>
+          <h3>19.5. RSA-PSS</h3>
           <div id="rsa-pss-description" class="section">
-            <h4>21.5.1. Description</h4>
+            <h4>19.5.1. Description</h4>
             <p>
               The <code>"RSA-PSS"</code> algorithm identifier is used to perform signing
               and verification using the RSASSA-PSS algorithm specified in
@@ -2389,7 +2566,7 @@
             </p>
           </div>
           <div id="rsa-pss-registration" class="section">
-            <h4>21.5.2. Registration</h4>
+            <h4>19.5.2. Registration</h4>
             <p>
               The <a href="#recognized-algorithm-name">recognized algorithm name</a> for
               this algorithm is <code>"RSA-PSS"</code>.
@@ -2422,7 +2599,7 @@
             </table>
           </div>
           <div id="rsa-pss-params" class="section">
-            <h4>21.5.3. RsaPssParams dictionary</h4>
+            <h4>19.5.3. RsaPssParams dictionary</h4>
             <div class="block"><div class="blockTitleDiv"><span class="blockTitle">IDL</span></div><div class="blockContent"><pre class="code"><code class="idl-code">
 dictionary <dfn id="dfn-RsaPssParams">RsaPssParams</dfn> : <a href="#dfn-AlgorithmParameters">AlgorithmParameters</a> {
   <span class="comment">// The hash function to apply to the message</span>
@@ -2435,7 +2612,7 @@
             </code></pre></div></div>
           </div>
           <div id="rsa-pss-operations" class="section">
-            <h4>21.5.4. Operations</h4>
+            <h4>19.5.4. Operations</h4>
             <ul>
               <li>Sign</li>
               <li>Verify</li>
@@ -2445,9 +2622,9 @@
         </div>
 
         <div id="rsa-oaep" class="section">
-          <h3>21.6. RSA-OAEP</h3>
+          <h3>19.6. RSA-OAEP</h3>
           <div id="rsa-oaep-description" class="section">
-            <h4>21.6.1. Description</h4>
+            <h4>19.6.1. Description</h4>
             <p>
               The <code>"RSA-OAEP"</code> algorithm identifier is used to perform encryption
               and decryption ordering to the RSAES-OAEP algorithm specified in
@@ -2455,7 +2632,7 @@
             </p>
           </div>
           <div id="rsa-oaep-registration" class="section">
-            <h4>21.6.2. Registration</h4>
+            <h4>19.6.2. Registration</h4>
             <p>
               The <a href="#recognized-algorithm-name">recognized algorithm name</a> for
               this algorithm is <code>"RSA-OAEP"</code>.
@@ -2489,7 +2666,7 @@
           </div>
 
           <div id="rsa-oaep-params" class="section">
-            <h4>21.6.3. RsaOaepParams dictionary</h4>
+            <h4>19.6.3. RsaOaepParams dictionary</h4>
             <div class="block"><div class="blockTitleDiv"><span class="blockTitle">IDL</span></div><div class="blockContent"><pre class="code"><code class="idl-code">
 dictionary <dfn id="dfn-RsaOaepParams">RsaOaepParams</dfn> : <a href="#dfn-AlgorithmParameters">AlgorithmParameters</a> {
   <span class="comment">// The hash function to apply to the message</span>
@@ -2502,7 +2679,7 @@
             </code></pre></div></div>
           </div>
           <div id="rsa-oaep-operations" class="section">
-            <h4>21.6.4. Operations</h4>
+            <h4>19.6.4. Operations</h4>
             <ul>
               <li>Encrypt</li>
               <li>Decrypt</li>
@@ -2512,9 +2689,9 @@
         </div>
 
         <div id="ecdsa" class="section">
-          <h3>21.7. ECDSA</h3>
+          <h3>19.7. ECDSA</h3>
           <div id="ecdsa-description" class="section">
-            <h4>21.7.1. Description</h4>
+            <h4>19.7.1. Description</h4>
             <p>
               The <code>"ECDSA"</code> algorithm identifier is used to perform signing
               and verification using the ECDSA algorithm specified in
@@ -2522,7 +2699,7 @@
             </p>
           </div>
           <div id="ecdsa-registration" class="section">
-            <h4>21.7.2. Registration</h4>
+            <h4>19.7.2. Registration</h4>
             <p>
               The <a href="#recognized-algorithm-name">recognized algorithm name</a> for
               this algorithm is <code>"ECDSA"</code>.
@@ -2556,7 +2733,7 @@
             </table>
           </div>
           <div id="EcdsaParams-dictionary" class="section">
-            <h4>21.7.3. EcdsaParams dictionary</h4>
+            <h4>19.7.3. EcdsaParams dictionary</h4>
             <div class="block"><div class="blockTitleDiv"><span class="blockTitle">IDL</span></div><div class="blockContent"><pre class="code"><code class="idl-code">
 dictionary <dfn id="dfn-EcdsaParams">EcdsaParams</dfn> : <a href="#dfn-AlgorithmParameters">AlgorithmParameters</a> {
   <span class="comment">// The hash algorithm to use</span>
@@ -2565,7 +2742,7 @@
             </code></pre></div></div>
           </div>
           <div id="EcKeyGenParams-dictionary" class="section">
-            <h4>21.7.4. EcKeyGenParams dictionary</h4>
+            <h4>19.7.4. EcKeyGenParams dictionary</h4>
             <div class="block"><div class="blockTitleDiv"><span class="blockTitle">IDL</span></div><div class="blockContent"><pre class="code"><code class="idl-code">
 enum <dfn id="dfn-NamedCurve">NamedCurve</dfn> {
   <span class="comment">// NIST recommended curve P-256, also known as secp256r1.</span>
@@ -2588,7 +2765,7 @@
           </div>
 
           <div id="ecdsa-operations" class="section">
-            <h4>21.7.5. Operations</h4>
+            <h4>19.7.5. Operations</h4>
             <dl>
               <dt>Sign</dt>
               <dd>
@@ -2706,24 +2883,22 @@
               </dd>
               <dt>Generate Key</dt>
               <dd>
-                When generating a key pair, the resultant <code><a href="#dfn-KeyGenerator">KeyGenerator</a></code>
-                shall behave as follows:
               </dd>
             </dl>
           </div>
         </div>
 
         <div id="ecdh" class="section">
-          <h3>21.8. ECDH</h3>
+          <h3>19.8. ECDH</h3>
           <div id="ecdh-description" class="section">
-            <h4>21.8.1. Description</h4>
+            <h4>19.8.1. Description</h4>
             <p>
               This describes using Elliptic Curve Diffie-Hellman (ECDH) for key generation and key agreement, as
               specified by <a href="#X9.63">X9.63</a>.
             </p>
           </div>
           <div id="ecdh-registration" class="section">
-            <h4>21.8.2. Registration</h4>
+            <h4>19.8.2. Registration</h4>
             <p>
               The <a href="#recognized-algorithm-name">recognized algorithm name</a> for
               this algorithm is <code>"ECDH"</code>.
@@ -2751,7 +2926,7 @@
             </table>
           </div>
           <div id="dh-EcdhKeyDeriveParams" class="section">
-            <h4>21.8.3. EcdhKeyDeriveParams dictionary</h4>
+            <h4>19.8.3. EcdhKeyDeriveParams dictionary</h4>
             <div class="block"><div class="blockTitleDiv"><span class="blockTitle">IDL</span></div><div class="blockContent"><pre class="code"><code class="idl-code">
 typedef Uint8Array <dfn id="dfn-ECPoint">ECPoint</dfn>;
 
@@ -2767,7 +2942,7 @@
             </p>
           </div>
           <div id="ecdh-operations" class="section">
-            <h4>21.8.4. Operations</h4>
+            <h4>19.8.4. Operations</h4>
             <ul>
               <li>Generate Key</li>
               <li>Derive Key</li>
@@ -2786,14 +2961,14 @@
         </div>
 
         <div id="aes-ctr" class="section">
-          <h3>21.9. AES-CTR</h3>
+          <h3>19.9. AES-CTR</h3>
           <div id="aes-ctr-description" class="section">
-            <h4>21.9.1. Description</h4>
+            <h4>19.9.1. Description</h4>
             <p>
             </p>
           </div>
           <div id="aes-ctr-registration" class="section">
-            <h4>21.9.2. Registration</h4>
+            <h4>19.9.2. Registration</h4>
             <p>
               The <a href="#recognized-algorithm-name">recognized algorithm name</a> for
               this algorithm is <code>"AES-CTR"</code>.
@@ -2827,7 +3002,7 @@
           </div>
 
           <div id="aes-ctr-params" class="section">
-            <h4>21.9.3. AesCtrParams dictionary</h4>
+            <h4>19.9.3. AesCtrParams dictionary</h4>
             <div class="block"><div class="blockTitleDiv"><span class="blockTitle">IDL</span></div><div class="blockContent"><pre class="code"><code class="idl-code">
 dictionary <dfn id="dfn-AesCtrParams">AesCtrParams</dfn> : <a href="#dfn-AlgorithmParameters">AlgorithmParameters</a> {
   <span class="comment">// The initial value of the counter block. counter <span class="RFC2119">MUST</span> be 16 bytes
@@ -2845,7 +3020,7 @@
             </code></pre></div></div>
           </div>
           <div id="aes-keygen-params" class="section">
-            <h4>21.9.4. AesKeyGenParams dictionary</h4>
+            <h4>19.9.4. AesKeyGenParams dictionary</h4>
             <div class="block"><div class="blockTitleDiv"><span class="blockTitle">IDL</span></div><div class="blockContent"><pre class="code"><code class="idl-code">
 dictionary <dfn id="dfn-AesKeyGenParams">AesKeyGenParams</dfn> : <a href="#dfn-AlgorithmParameters">AlgorithmParameters</a> {
   <span class="comment">// The length, in bits, of the key.</span>
@@ -2854,7 +3029,7 @@
             </code></pre></div></div>
           </div>
           <div id="aes-ctr-operations" class="section">
-            <h4>21.9.5. Operations</h4>
+            <h4>19.9.5. Operations</h4>
             <ul>
               <li>Encrypt</li>
               <li>Decrypt</li>
@@ -2864,12 +3039,12 @@
         </div>
 
         <div id="aes-cbc" class="section">
-          <h3>21.10. AES-CBC</h3>
+          <h3>19.10. AES-CBC</h3>
           <div id="aes-cbc-description" class="section">
-            <h4>21.10.1. Description</h4>
+            <h4>19.10.1. Description</h4>
           </div>
           <div id="aes-cbc-registration" class="section">
-            <h4>21.10.2. Registration</h4>
+            <h4>19.10.2. Registration</h4>
             <p>
               The <a href="#recognized-algorithm-name">recognized algorithm name</a> for
               this algorithm is <code>"AES-CBC"</code>.
@@ -2902,7 +3077,7 @@
             </table>
           </div>
           <div id="aes-cbc-params" class="section">
-            <h4>21.10.3. AesCbcParams dictionary</h4>
+            <h4>19.10.3. AesCbcParams dictionary</h4>
             <div class="block"><div class="blockTitleDiv"><span class="blockTitle">IDL</span></div><div class="blockContent"><pre class="code"><code class="idl-code">
 dictionary <dfn id="dfn-AesCbcParams">AesCbcParams</dfn> : <a href="#dfn-AlgorithmParameters">AlgorithmParameters</a> {
   <span class="comment">// The initialization vector. <span class="RFC2119">MUST</span> be 16 bytes.</span>
@@ -2911,7 +3086,7 @@
             </code></pre></div></div>
           </div>
           <div id="aes-cbc-operations" class="section">
-            <h4>21.10.4. Operations</h4>
+            <h4>19.10.4. Operations</h4>
             <ul>
               <li>Encrypt</li>
               <li>Decrypt</li>
@@ -2921,12 +3096,12 @@
         </div>
 
         <div id="aes-gcm" class="section">
-          <h3>21.11. AES-GCM</h3>
+          <h3>19.11. AES-GCM</h3>
           <div id="aes-gcm-description" class="section">
-            <h4>21.11.1. Description</h4>
+            <h4>19.11.1. Description</h4>
           </div>
           <div id="aes-gcm-registration" class="section">
-             <h4>21.11.2. Registration</h4>
+             <h4>19.11.2. Registration</h4>
              <p>
                The <a href="#recognized-algorithm-name">recognized algorithm name</a> for
                this algorithm is <code>"AES-GCM"</code>.
@@ -2959,7 +3134,7 @@
              </table>
            </div>
           <div id="aes-gcm-params" class="section">
-            <h4>21.11.3. AesGcmParams dictionary</h4>
+            <h4>19.11.3. AesGcmParams dictionary</h4>
             <div class="block"><div class="blockTitleDiv"><span class="blockTitle">IDL</span></div><div class="blockContent"><pre class="code"><code class="idl-code">
 dictionary <dfn id="dfn-AesGcmParams">AesGcmParams</dfn> : <a href="#dfn-AlgorithmParameters">AlgorithmParameters</a> {
   <span class="comment">// The initialization vector to use. May be up to 2^56 bytes long.</span>
@@ -2972,7 +3147,7 @@
             </code></pre></div></div>
           </div>
           <div id="aes-gcm-operations" class="section">
-            <h4>21.11.4. Operations</h4>
+            <h4>19.11.4. Operations</h4>
             <ul>
               <li>Encrypt</li>
               <li>Decrypt</li>
@@ -2982,12 +3157,12 @@
         </div>
 
         <div id="hmac" class="section">
-          <h3>21.12. HMAC</h3>
+          <h3>19.12. HMAC</h3>
           <div id="hmac-description" class="section">
-            <h4>21.12.1. Description</h4>
+            <h4>19.12.1. Description</h4>
           </div>
           <div id="hmac-registration" class="section">
-            <h4>21.12.2. Registration</h4>
+            <h4>19.12.2. Registration</h4>
             <p>
               The <a href="#recognized-algorithm-name">recognized algorithm name</a> for
               this algorithm is <code>"HMAC"</code>.
@@ -3020,7 +3195,7 @@
             </table>
           </div>
           <div id="hmac-params" class="section">
-            <h4>21.12.3. HmacParams dictionary</h4>
+            <h4>19.12.3. HmacParams dictionary</h4>
             <div class="block"><div class="blockTitleDiv"><span class="blockTitle">IDL</span></div><div class="blockContent"><pre class="code"><code class="idl-code">
 dictionary <dfn id="dfn-HmacParams">HmacParams</dfn> : <a href="#dfn-AlgorithmParameters">AlgorithmParameters</a> {
   <span class="comment">// The inner hash function to use.</span>
@@ -3029,7 +3204,7 @@
             </code></pre></div></div>
           </div>
           <div id="hmac-operations" class="section">
-            <h4>21.12.4. Operations</h4>
+            <h4>19.12.4. Operations</h4>
             <ul>
               <li>Sign</li>
               <li>Verify</li>
@@ -3038,16 +3213,16 @@
           </div>
         </div>
         <div id="dh" class="section">
-          <h3>21.13. Diffie-Hellman</h3>
+          <h3>19.13. Diffie-Hellman</h3>
           <div id="dh-description" class="section">
-            <h4>21.13.1. Description</h4>
+            <h4>19.13.1. Description</h4>
             <p>
               This describes using Diffie-Hellman for key generation and key agreement, as specified
               by <a href="#PKCS3">PKCS #3</a>.
             </p>
           </div>
           <div id="dh-registration" class="section">
-            <h4>21.13.2. Registration</h4>
+            <h4>19.13.2. Registration</h4>
             <p>
               The <a href="#recognized-algorithm-name">recognized algorithm name</a> for
               this algorithm is <code>"DH"</code>.
@@ -3075,7 +3250,7 @@
             </table>
           </div>
           <div id="dh-DhKeyGenParams" class="section">
-            <h4>21.13.3. DhKeyGenParams dictionary</h4>
+            <h4>19.13.3. DhKeyGenParams dictionary</h4>
             <div class="block"><div class="blockTitleDiv"><span class="blockTitle">IDL</span></div><div class="blockContent"><pre class="code"><code class="idl-code">
 dictionary <dfn id="dfn-DhKeyGenParams">DhKeyGenParams</dfn> : <a href="#dfn-AlgorithmParameters">AlgorithmParameters</a> {
   <span class="comment">// The prime p.</span>
@@ -3086,7 +3261,7 @@
             </code></pre></div></div>
           </div>
           <div id="dh-DhKeyDeriveParams" class="section">
-            <h4>21.13.4. DhKeyDeriveParams dictionary</h4>
+            <h4>19.13.4. DhKeyDeriveParams dictionary</h4>
             <div class="block"><div class="blockTitleDiv"><span class="blockTitle">IDL</span></div><div class="blockContent"><pre class="code"><code class="idl-code">
 dictionary <dfn id="dfn-DhKeyDeriveParams">DhKeyDeriveParams</dfn> : <a href="#dfn-AlgorithmParameters">AlgorithmParameters</a> {
   <span class="comment">// The peer's public value.</span>
@@ -3095,7 +3270,7 @@
             </code></pre></div></div>
           </div>
           <div id="dh-operations" class="section">
-            <h4>21.13.5. Operations</h4>
+            <h4>19.13.5. Operations</h4>
             <ul>
               <li>Generate Key</li>
               <li>Derive Key</li>
@@ -3103,16 +3278,16 @@
           </div>
         </div>
         <div id="sha" class="section">
-          <h3>21.14. SHA</h3>
+          <h3>19.14. SHA</h3>
           <div id="sha-description" class="section">
-            <h4>21.14.1. Description</h4>
+            <h4>19.14.1. Description</h4>
             <p>
               This describes the SHA-1 and SHA-2 families, as specified by
               [<a href="#FIPS180-4">FIPS 180-4</a>].
             </p>
           </div>
           <div id="sha-registration" class="section">
-            <h4>21.14.2. Registration</h4>
+            <h4>19.14.2. Registration</h4>
             <p>
               The following algorithms are added as <a href="#recognized-algorithm-name">
               recognized algorithm names</a>:
@@ -3147,16 +3322,16 @@
             </table>
           </div>
           <div id="sha-operations" class="section">
-            <h4>21.14.3. Operations</h4>
+            <h4>19.14.3. Operations</h4>
             <ul>
               <li>Digest</li>
             </ul>
           </div>
         </div>
         <div id="concatkdf" class="section">
-          <h3>21.15. Concat KDF</h3>
+          <h3>19.15. Concat KDF</h3>
           <div id="concatkdf-description" class="section">
-            <h4>21.15.1. Description</h4>
+            <h4>19.15.1. Description</h4>
             <p>
               The <code>"CONCAT"</code> algorithm identifier is used to perform key derivation
               using the key derivation algorithm defined in Section 5.8.1 of NIST SP 800-56A
@@ -3164,7 +3339,7 @@
             </p>
           </div>
           <div id="concatkdf-registration" class="section">
-            <h4>21.15.2. Registration</h4>
+            <h4>19.15.2. Registration</h4>
             <p>
               The <a href="#recognized-algorithm-name">recognized algorithm name</a> for
               this algorithm is <code>"CONCAT"</code>.
@@ -3187,7 +3362,7 @@
             </table>
           </div>
           <div id="concat-params" class="section">
-            <h4>21.15.3. ConcatParams dictionary</h4>
+            <h4>19.15.3. ConcatParams dictionary</h4>
             <div class="block"><div class="blockTitleDiv"><span class="blockTitle">IDL</span></div><div class="blockContent"><pre class="code"><code class="idl-code">
 dictionary <dfn id="dfn-ConcatParams">ConcatParams</dfn> : <a href="#dfn-AlgorithmParameters">AlgorithmParameters</a> {
   <span class="comment">// The digest method to use to derive the keying material.</span>
@@ -3210,19 +3385,19 @@
             </code></pre></div></div>
           </div>
           <div id="concat-operations" class="section">
-            <h4>21.15.4. Operations</h4>
+            <h4>19.15.4. Operations</h4>
             <ul>
               <li>Derive Key</li>
             </ul>
           </div>
         </div>
         <div id="pbkdf2" class="section">
-          <h3>21.16. PBKDF2</h3>
+          <h3>19.16. PBKDF2</h3>
           <div id="pbkdf2-description" class="section">
-            <h4>21.16.1. Description</h4>
+            <h4>19.16.1. Description</h4>
           </div>
           <div id="pbkdf2-registration" class="section">
-            <h4>21.16.2. Registration</h4>
+            <h4>19.16.2. Registration</h4>
             <p>
               The <a href="#recognized-algorithm-name">recognized algorithm name</a> for
               this algorithm is <code>"PBKDF2"</code>.
@@ -3245,7 +3420,7 @@
             </table>
           </div>
           <div id="pbkdf2-params" class="section">
-            <h4>21.16.3. Pbkdf2Params dictionary</h4>
+            <h4>19.16.3. Pbkdf2Params dictionary</h4>
             <div class="block"><div class="blockTitleDiv"><span class="blockTitle">IDL</span></div><div class="blockContent"><pre class="code"><code class="idl-code">
 dictionary <dfn id="dfn-Pbkdf2Params">Pbkdf2Params</dfn> : <a href="#dfn-AlgorithmParameters">AlgorithmParameters</a> {
   ArrayBufferView salt;
@@ -3264,7 +3439,7 @@
             </div>
           </div>
           <div id="pbkdf2-operations" class="section">
-            <h4>21.16.4. Operations</h4>
+            <h4>19.16.4. Operations</h4>
             <ul>
               <li>Derive Key</li>
             </ul>
@@ -3273,7 +3448,7 @@
       </div>
  
       <div id="algorithm-normalizing-rules" class="section">
-        <h2>22. Algorithm normalizing rules</h2>
+        <h2>20. Algorithm normalizing rules</h2>
         <p>
           The <a href="#dfn-AlgorithmIdentifier"><code>AlgorithmIdentifier</code></a> typedef
           permits algorithms to be specified as either a <code>dictionary</code> or a DOMString.
@@ -3343,9 +3518,9 @@
         </ol>
       </div>
       <div id="examples-section" class="section">
-        <h2>23. JavaScript Example Code</h2>
+        <h2>21. JavaScript Example Code</h2>
         <div id="examples-signing" class="section">
-          <h3>23.1. Generate a signing key pair, sign some data</h3>
+          <h3>21.1. Generate a signing key pair, sign some data</h3>
         
         <div class="block"><div class="blockTitleDiv"><span class="blockTitle">ECMAScript</span></div><div class="blockContent"><pre class="code"><code class="es-code">
 var publicExponent = new Uint8Array([0x01, 0x00, 0x01]); 
@@ -3414,7 +3589,7 @@
         </code></pre></div></div>
         </div>
         <div id="examples-symmetric-encryption" class="section">
-          <h3>23.2. Symmetric Encryption</h3>
+          <h3>21.2. Symmetric Encryption</h3>
         <div class="block"><div class="blockTitleDiv"><span class="blockTitle">ECMAScript</span></div><div class="blockContent"><pre class="code"><code class="es-code">
 var clearDataArrayBufferView = convertPlainTextToArrayBufferView("Plain Text Data");
 <span class="comment">// TODO: create example utility function that converts text -&gt; ArrayBufferView</span>
@@ -3476,7 +3651,7 @@
       </div>
     </div>
       <div id="acknowledgements-section" class="section">
-        <h2>24. Acknowledgements</h2>
+        <h2>22. Acknowledgements</h2>
         <p>
           The editors would like to thank Adam Barth, Ali Asad, Arun Ranganathan, Brian Smith,
           Brian Warner, Channy Yun, Kai Engert, Mark Watson, Vijay Bharadwaj, Virginie Galindo,
@@ -3497,9 +3672,9 @@
         </p>
       </div>
       <div id="references" class="section">
-         <h2>25. References</h2>
+         <h2>23. References</h2>
          <div id="normative-references" class="section">
-           <h3>25.1. Normative References</h3>
+           <h3>23.1. Normative References</h3>
            <dl>
              <dt id="RFC2119">RFC2119</dt>
              <dd>
@@ -3572,7 +3747,7 @@
            </dl>
         </div>
         <div id="informative-references" class="section">
-          <h3>25.2. Informative References</h3>
+          <h3>23.2. Informative References</h3>
           <dl>
             <dt id="draft-TLS-OBC">draft-balfanz-tls-obc-01</dt>
             <dd>