Bug 24415 Replace enums with DOMStrings
authorMark Watson <watsonm@netflix.com>
Mon, 27 Jan 2014 16:07:58 -0800
changeset 93 737e12c5ad33
parent 92 33a21d9f624a
child 94 84ee476e7fc1
Bug 24415 Replace enums with DOMStrings
spec/Overview-WebCryptoAPI.xml
spec/Overview.html
--- a/spec/Overview-WebCryptoAPI.xml	Mon Jan 27 15:00:38 2014 -0800
+++ b/spec/Overview-WebCryptoAPI.xml	Mon Jan 27 16:07:58 2014 -0800
@@ -674,25 +674,12 @@
           user agent.
         </p>
         <x:codeblock language="idl">
-enum <dfn id="dfn-KeyType">KeyType</dfn> {
-  "secret",
-  "public",
-  "private"
-};
+typedef DOMString <a href="#dfn-KeyType">KeyType</a>;
 
-enum <dfn id="dfn-KeyUsage">KeyUsage</dfn> {
-  "encrypt",
-  "decrypt",
-  "sign",
-  "verify",
-  "deriveKey",
-  "deriveBits",
-  "wrapKey",
-  "unwrapKey"
-};
+typedef DOMString <a href="#dfn-KeyUsage">KeyUsage</a>;
 
 interface <dfn id="dfn-Key">Key</dfn> {
-  readonly attribute KeyType <a href="#dfn-Key-type">type</a>;
+  readonly attribute <a href="#dfn-KeyType">KeyType</a> <a href="#dfn-Key-type">type</a>;
   readonly attribute boolean <a href="#dfn-Key-extractable">extractable</a>;
   readonly attribute <a href="#dfn-Algorithm">Algorithm</a> <a href="#dfn-Key-algorithm">algorithm</a>;
   readonly attribute <a href="#dfn-KeyUsage">KeyUsage</a>[] <a href="#dfn-Key-usages">usages</a>;
@@ -718,15 +705,35 @@
           </p>
         </div>
 
+        <div id="key-interface-types" class="section">
+          <h3>Key interface data types</h3>
+          <dl>
+            <dt id="dfn-KeyType"><code>KeyType</code></dt>
+            <dd>The type of a key. The recognized <code>KeyType</code> values are <code>"public"</code>, <code>"private"</code> and <code>"secret"</code>.
+                Opaque keying material, including that used for symmetric algorithms, is represented by <code>"secret"</code>,
+                while keys used as part of asymmetric algorithms composed of public/private keypairs will be either
+                <code>"public"</code> or <code>"private"</code>.
+            </dd>
+            <dt id="dfn-KeyUsage"><code>KeyUsage</code></dt>
+            <dd>A type of operation that may be performed using a key. The recognized <code>KeyUsage</code> values are
+                    <code>"encrypt"</code>,
+                    <code>"decrypt"</code>,
+                    <code>"sign"</code>,
+                    <code>"verify"</code>,
+                    <code>"deriveKey"</code>,
+                    <code>"deriveBits"</code>,
+                    <code>"wrapKey"</code> and
+                    <code>"unwrapKey"</code>.
+            </dd>
+          </dl>
+        </div>
+
         <div id="key-interface-members" class="section">
           <h3>Key interface members</h3>
           <dl>
             <dt id="dfn-Key-type"><code>type</code></dt>
             <dd>
-              The type of the underlying key. Opaque keying material, including that used for
-              symmetric algorithms, is represented by <code>"secret"</code>, while keys used as
-              part of asymmetric algorithms composed of public/private keypairs will be either
-              <code>"public"</code> or <code>"private"</code>.
+              The type of the underlying key.
             </dd>
             <dt id="dfn-Key-extractable"><code>extractable</code></dt>
             <dd>
@@ -1046,7 +1053,7 @@
                 <h5>Mapping of usages</h5>
                 <p>When exporting a WebCrypto <a href="#dfn-Key">Key</a> in JWK format, the value of the <a href="#dfn-Key">Key</a>.usages array shall be copied into the JWK <code>key_ops</code> member where each WebCryto <a href="#dfn-KeyUsage">KeyUsage</a> value maps to the JWK <code>key_ops</code> value of the same name. The <code>use</code> member shall not be present.</p>
                 <p>When importing a JWK format key into a WebCrypto <a href="#dfn-Key">Key</a> object, if the <code>key_ops</code> member is present then the
-                  WebCryto <a href="#dfn-KeyUsage">KeyUsages</a> specified by this JWK shall be equal to the values listed in <code>key_ops</code>  where each JWK <code>key_ops</code> value maps to the WebCryto <a href="#dfn-KeyUsage">KeyUsage</a> value of the same name. If the <code>key_ops</code> member is not present and the <code>use</code> member is present, then the WebCryto <a href="#dfn-KeyUsage">KeyUsages</a> specified by this JWK shall be as specified in the following table:
+                  WebCryto <a href="#dfn-KeyUsage">KeyUsages</a> specified by this JWK shall be equal to the values listed in <code>key_ops</code>  where each JWK <code>key_ops</code> value maps to the WebCryto <a href="#dfn-KeyUsage">KeyUsage</a> value of the same name, except that unrecognized values SHALL be ignored. If the <code>key_ops</code> member is not present and the <code>use</code> member is present, then the WebCryto <a href="#dfn-KeyUsage">KeyUsages</a> specified by this JWK shall be as specified in the following table:
                   </p>
                   
                   <table>
@@ -1096,16 +1103,7 @@
       <div id="subtlecrypto-interface" class="section">
         <h2>SubtleCrypto 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>
-  "raw",
-  <span class="comment">// The DER encoding of the PrivateKeyInfo structure from <a href="#RFC5208">RFC 5208</a>.</span>
-  "pkcs8",
-  <span class="comment">// The DER encoding of the SubjectPublicKeyInfo structure from <a href="#RFC5280">RFC 5280</a>.</span>
-  "spki",
-  <span class="comment">// The key is represented as JSON according to the JSON Web Key format.</span>
-  "jwk",
-};
+typedef DOMString <a href="#dfn-KeyFormat"><code>KeyFormat</code></a>;
 
 typedef (ArrayBuffer or ArrayBufferView) CryptoOperationData;
 
@@ -1201,6 +1199,25 @@
           </p>
         </div>
 
+        <div id="subtlecrypto-interface-datatypes" class="section">
+          <h3>Data Types</h3>
+          <dl>
+            <dt id="dfn-KeyFormat"><code>KeyFormat</code></dt>
+            <dd>Specifies a serialization format for a key. The following values are recognized:
+              <dl>
+                <dt><code>raw</code></dt>
+                <dd>An unformatted sequence of bytes. Intended for secret keys.</dd>
+                <dt><code>pkcs8</code></dt>
+                <dd>The DER encoding of the PrivateKeyInfo structure from <a href="#RFC5208">RFC 5208</a>.</dd>
+                <dt><code>spki</code></dt>
+                <dd>The DER encoding of the SubjectPublicKeyInfo structure from <a href="#RFC5280">RFC 5280</a>.</dd>
+                <dt><code>jwk</code></dt>
+                <dd>The key is represented as JSON according to the JSON Web Key format.</dd>
+              </dl>
+            </dd>
+          </dl>
+        </div>
+
         <div id="subtlecrypto-interface-methods" class="section">
           <h3>Methods and Parameters</h3>
           <div id="SubtleCrypto-method-encrypt" class="section">
@@ -1527,6 +1544,12 @@
               </li>
               <li>
                 <p>
+                  If <code>keyUsages</code> includes a value that is not a recognized <a href="#dfn-KeyUsage"><code>KeyUsage</code></a> value, throw
+                  a <code>NotSupportedError</code> and <a href="#terminate-the-algorithm">terminate the algorithm</a>
+                </p>
+              </li>
+              <li>
+                <p>
                   Let <var>promise</var> be a new <code>Promise</code> object and <var>resolver</var> its associated resolver.
                 </p>
               </li>
@@ -1599,6 +1622,12 @@
               </li>
               <li>
                 <p>
+                  If <code>keyUsages</code> includes a value that is not a recognized <a href="#dfn-KeyUsage"><code>KeyUsage</code></a> value, throw
+                  a <code>NotSupportedError</code> and <a href="#terminate-the-algorithm">terminate the algorithm</a>
+                </p>
+              </li>
+              <li>
+                <p>
                   Let <var>promise</var> be a new <code>Promise</code> object and <var>resolver</var> its associated resolver.
                 </p>
               </li>
@@ -1762,6 +1791,18 @@
               </li>
               <li>
                 <p>
+                  If <code>format</code> is not a recognized <a href="#dfn-KeyFormat"><code>KeyFormat</code></a> value, throw
+                  a <code>NotSupportedError</code> and <a href="#terminate-the-algorithm">terminate the algorithm</a>
+                </p>
+              </li>
+              <li>
+                <p>
+                  If <code>keyUsages</code> includes a value that is not a recognized <a href="#dfn-KeyUsage"><code>KeyUsage</code></a> value, throw
+                  a <code>NotSupportedError</code> and <a href="#terminate-the-algorithm">terminate the algorithm</a>
+                </p>
+              </li>
+              <li>
+                <p>
                   Let <var>format</var>, <var>keyData</var>, <var>extractable</var> and <var>usages</var> be the <code>format</code>, <code>keyData</code>,
                   <code>extractable</code> and <code>usages</code> parameters to the <dfn id="dfn-SubtleCrypto-method-importKey">importKey</dfn> method respectively.
                 </p>
@@ -1835,6 +1876,13 @@
               When invoked, the <dfn id="dfn-SubtleCrypto-method-exportKey">exportKey</dfn> method <span class="RFC2119">MUST</span> perform the following steps:
             </p>
             <ol>
+            
+              <li>
+                <p>
+                  If <code>format</code> is not a recognized <a href="#dfn-KeyFormat"><code>KeyFormat</code></a> value, throw
+                  a <code>NotSupportedError</code> and <a href="#terminate-the-algorithm">terminate the algorithm</a>
+                </p>
+              </li>
               <li>
                 <p>
                   Let <var>key</var> and <var>format</var> be the values of the <code>key</code> and <code>format</code> parameters to the
@@ -1908,6 +1956,12 @@
               </li>
               <li>
                 <p>
+                  If <code>format</code> is not a recognized <a href="#dfn-KeyFormat"><code>KeyFormat</code></a> value, throw
+                  a <code>NotSupportedError</code> and <a href="#terminate-the-algorithm">terminate the algorithm</a>
+                </p>
+              </li>
+              <li>
+                <p>
                   Let <var>promise</var> be a new <code>Promise</code> object and <var>resolver</var> its associated resolver.
                 </p>
               </li>
@@ -2027,6 +2081,18 @@
               </li>
               <li>
                 <p>
+                  If <code>format</code> is not a recognized <a href="#dfn-KeyFormat"><code>KeyFormat</code></a> value, throw
+                  a <code>NotSupportedError</code> and <a href="#terminate-the-algorithm">terminate the algorithm</a>
+                </p>
+              </li>
+              <li>
+                <p>
+                  If <code>keyUsages</code> includes a value that is not a recognized <a href="#dfn-KeyUsage"><code>KeyUsage</code></a> value, throw
+                  a <code>NotSupportedError</code> and <a href="#terminate-the-algorithm">terminate the algorithm</a>
+                </p>
+              </li>
+              <li>
+                <p>
                   Let <var>promise</var> be a new <code>Promise</code> object and <var>resolver</var> its associated resolver.
                 </p>
               </li>
@@ -3050,14 +3116,7 @@
           <div id="EcKeyGenParams-dictionary" class="section">
             <h4>EcKeyGenParams dictionary</h4>
             <x:codeblock language="idl">
-enum <dfn id="dfn-NamedCurve">NamedCurve</dfn> {
-  <span class="comment">// NIST recommended curve P-256, also known as secp256r1.</span>
-  <dfn id="dfn-NamedCurve-p256">"P-256"</dfn>,
-  <span class="comment">// NIST recommended curve P-384, also known as secp384r1.</span>
-  <dfn id="dfn-NamedCurve-p384">"P-384"</dfn>,
-  <span class="comment">// NIST recommended curve P-521, also known as secp521r1.</span>
-  <dfn id="dfn-NamedCurve-p521">"P-521"</dfn>
-};
+typedef DOMString <a href="#dfn-NamedCurve">NamedCurve</a>;
 
 dictionary <dfn id="dfn-EcKeyGenParams">EcKeyGenParams</dfn> : <a href="#dfn-Algorithm">Algorithm</a> {
   <span class="comment">// A named curve</span>
@@ -3065,8 +3124,16 @@
 };
             </x:codeblock>
             <p>
-              The <a href="#dfn-NamedCurve">NamedCurve</a> enumeration type represents named elliptic curves, which
-              are a convenient way to specify the domain parameters of well-known elliptic curves.
+              The <dfn id="dfn-NamedCurve">NamedCurve</dfn> type represents named elliptic curves, which
+              are a convenient way to specify the domain parameters of well-known elliptic curves. The following values are recognized:
+              <dl>
+                <dt id="dfn-NamedCurve-p256"><code>P-256</code></dt>
+                <dd>NIST recommended curve P-256, also known as <code>secp256r1</code>.</dd>
+                <dt id="dfn-NamedCurve-p2384"><code>P-384</code></dt>
+                <dd>NIST recommended curve P-384, also known as <code>secp384r1</code>.</dd>
+                <dt id="dfn-NamedCurve-p521"><code>P-521</code></dt>
+                <dd>NIST recommended curve P-521, also known as <code>secp521r1</code>.</dd>
+              </dl>
             </p>
           </div>
 
--- a/spec/Overview.html	Mon Jan 27 15:00:38 2014 -0800
+++ b/spec/Overview.html	Mon Jan 27 16:07:58 2014 -0800
@@ -136,7 +136,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 authors</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><li><a href="#key-interface-jwk">11.4. Representation using JSON Web Key</a><ul><li><a href="#key-interface-jwk-extensions">11.4.1. Extensions to JSON Web Key</a><ul><li><a href="#key-interface-jwk-algorithms">11.4.1.1. JSON Web Key algorithm names for WebCrypto algorithms</a></li><li><a href="#key-interface-jwk-ext">11.4.1.2. JSON Web Key ext attribute</a></li></ul></li><li><a href="#key-interface-jwk-mapping">11.4.2. Mapping between WebCrypto and JSON Web Key</a><ul><li><a href="#key-interface-jwk-mapping-alg">11.4.2.1. Mapping of algorithms</a></li><li><a href="#key-interface-jwk-mapping-use">11.4.2.2. Mapping of usages</a></li><li><a href="#key-interface-jwk-mapping-ext">11.4.2.3. Mapping of extractable</a></li></ul></li></ul></li></ul></li><li><a href="#crypto-interface">12. Crypto interface</a></li><li><a href="#subtlecrypto-interface">13. SubtleCrypto interface</a><ul><li><a href="#subtlecrypto-interface-description">13.1. Description</a></li><li><a href="#subtlecrypto-interface-methods">13.2. Methods and Parameters</a><ul><li><a href="#SubtleCrypto-method-encrypt">13.2.1. The encrypt method</a></li><li><a href="#SubtleCrypto-method-decrypt">13.2.2. The decrypt method</a></li><li><a href="#SubtleCrypto-method-sign">13.2.3. The sign method</a></li><li><a href="#SubtleCrypto-method-verify">13.2.4. The verify method</a></li><li><a href="#SubtleCrypto-method-digest">13.2.5. The digest method</a></li><li><a href="#SubtleCrypto-method-generateKey">13.2.6. The generateKey method</a></li><li><a href="#SubtleCrypto-method-deriveKey">13.2.7. The deriveKey method</a></li><li><a href="#SubtleCrypto-method-deriveBits">13.2.8. The deriveBits method</a></li><li><a href="#SubtleCrypto-method-importKey">13.2.9. The importKey method</a></li><li><a href="#SubtleCrypto-method-exportKey">13.2.10. The exportKey method</a></li><li><a href="#SubtleCrypto-method-wrapKey">13.2.11. The wrapKey method</a></li><li><a href="#SubtleCrypto-method-unwrapKey">13.2.12. The unwrapKey method</a></li></ul></li></ul></li><li><a href="#WorkerCrypto-interface">14. WorkerCrypto interface</a><ul><li><a href="#WorkerCrypto-description">14.1. Description</a></li></ul></li><li><a href="#big-integer">15. BigInteger</a></li><li><a href="#keypair">16. KeyPair</a></li><li><a href="#algorithms">17. Algorithms</a><ul><li><a href="#algorithms-index">17.1. Registered algorithms</a></li><li><a href="#recommended-algorithms">17.2. Recommended algorithms</a></li><li><a href="#defining-an-algorithm">17.3. Defining an algorithm</a><ul><li><a href="#recognized-algorithm-name">17.3.1. Recognized algorithm name</a></li><li><a href="#supported-operations">17.3.2. Supported operations</a></li><li><a href="#algorithm-specific-params">17.3.3. Algorithm-specific parameters</a></li><li><a href="#algorithm-result">17.3.4. Algorithm results</a></li><li><a href="#algorithm-alias">17.3.5. Algorithm aliases</a></li></ul></li><li><a href="#rsaes-pkcs1">17.4. RSAES-PKCS1-v1_5</a><ul><li><a href="#rsaes-pkcs1-description">17.4.1. Description</a></li><li><a href="#rsaes-pkcs1-registration">17.4.2. Registration</a></li><li><a href="#RsaKeyGenParams-dictionary">17.4.3. RsaKeyGenParams dictionary</a></li><li><a href="#rsaes-pkcs1-operations">17.4.4. Operations</a></li></ul></li><li><a href="#rsassa-pkcs1">17.5. RSASSA-PKCS1-v1_5</a><ul><li><a href="#rsassa-pkcs1-description">17.5.1. Description</a></li><li><a href="#rsassa-pkcs1-registration">17.5.2. Registration</a></li><li><a href="#RsaSsaParams-dictionary">17.5.3. RsaSsaParams dictionary</a></li><li><a href="#rsassa-pkcs1-operations">17.5.4. Operations</a></li></ul></li><li><a href="#rsa-pss">17.6. RSA-PSS</a><ul><li><a href="#rsa-pss-description">17.6.1. Description</a></li><li><a href="#rsa-pss-registration">17.6.2. Registration</a></li><li><a href="#rsa-pss-params">17.6.3. RsaPssParams dictionary</a></li><li><a href="#rsa-pss-operations">17.6.4. Operations</a></li></ul></li><li><a href="#rsa-oaep">17.7. RSA-OAEP</a><ul><li><a href="#rsa-oaep-description">17.7.1. Description</a></li><li><a href="#rsa-oaep-registration">17.7.2. Registration</a></li><li><a href="#rsa-oaep-params">17.7.3. RsaOaepParams dictionary</a></li><li><a href="#rsa-oaep-operations">17.7.4. Operations</a></li></ul></li><li><a href="#ecdsa">17.8. ECDSA</a><ul><li><a href="#ecdsa-description">17.8.1. Description</a></li><li><a href="#ecdsa-registration">17.8.2. Registration</a></li><li><a href="#EcdsaParams-dictionary">17.8.3. EcdsaParams dictionary</a></li><li><a href="#EcKeyGenParams-dictionary">17.8.4. EcKeyGenParams dictionary</a></li><li><a href="#ecdsa-operations">17.8.5. Operations</a></li></ul></li><li><a href="#ecdh">17.9. ECDH</a><ul><li><a href="#ecdh-description">17.9.1. Description</a></li><li><a href="#ecdh-registration">17.9.2. Registration</a></li><li><a href="#dh-EcdhKeyDeriveParams">17.9.3. EcdhKeyDeriveParams dictionary</a></li><li><a href="#ecdh-operations">17.9.4. Operations</a></li></ul></li><li><a href="#aes-ctr">17.10. AES-CTR</a><ul><li><a href="#aes-ctr-description">17.10.1. Description</a></li><li><a href="#aes-ctr-registration">17.10.2. Registration</a></li><li><a href="#aes-ctr-params">17.10.3. AesCtrParams dictionary</a></li><li><a href="#aes-keygen-params">17.10.4. AesKeyGenParams dictionary</a></li><li><a href="#aes-ctr-operations">17.10.5. Operations</a></li></ul></li><li><a href="#aes-cbc">17.11. AES-CBC</a><ul><li><a href="#aes-cbc-description">17.11.1. Description</a></li><li><a href="#aes-cbc-registration">17.11.2. Registration</a></li><li><a href="#aes-cbc-params">17.11.3. AesCbcParams dictionary</a></li><li><a href="#aes-cbc-operations">17.11.4. Operations</a></li></ul></li><li><a href="#aes-cmac">17.12. AES-CMAC</a><ul><li><a href="#aes-cmac-description">17.12.1. Description</a></li><li><a href="#aes-cmac-registration">17.12.2. Registration</a></li><li><a href="#aes-cmac-operations">17.12.3. Operations</a></li></ul></li><li><a href="#aes-gcm">17.13. AES-GCM</a><ul><li><a href="#aes-gcm-description">17.13.1. Description</a></li><li><a href="#aes-gcm-registration">17.13.2. Registration</a></li><li><a href="#aes-gcm-params">17.13.3. AesGcmParams dictionary</a></li><li><a href="#aes-gcm-operations">17.13.4. Operations</a></li></ul></li><li><a href="#aes-cfb">17.14. AES-CFB</a><ul><li><a href="#aes-cfb-description">17.14.1. Description</a></li><li><a href="#aes-cfb-registration">17.14.2. Registration</a></li><li><a href="#aes-cfb-params">17.14.3. AesCfbParams dictionary</a></li><li><a href="#aes-cfb-operations">17.14.4. Operations</a></li></ul></li><li><a href="#aes-kw">17.15. AES-KW</a><ul><li><a href="#aes-kw-description">17.15.1. Description</a></li><li><a href="#aes-kw-registration">17.15.2. Registration</a></li><li><a href="#aes-kw-operations">17.15.3. Operations</a></li></ul></li><li><a href="#hmac">17.16. HMAC</a><ul><li><a href="#hmac-description">17.16.1. Description</a></li><li><a href="#hmac-registration">17.16.2. Registration</a></li><li><a href="#hmac-params">17.16.3. HmacParams dictionary</a></li><li><a href="#hmac-key-params">17.16.4. HmacKeyParams dictionary</a></li><li><a href="#hmac-operations">17.16.5. Operations</a></li></ul></li><li><a href="#dh">17.17. Diffie-Hellman</a><ul><li><a href="#dh-description">17.17.1. Description</a></li><li><a href="#dh-registration">17.17.2. Registration</a></li><li><a href="#dh-DhKeyGenParams">17.17.3. DhKeyGenParams dictionary</a></li><li><a href="#dh-DhKeyDeriveParams">17.17.4. DhKeyDeriveParams dictionary</a></li><li><a href="#dh-operations">17.17.5. Operations</a></li></ul></li><li><a href="#sha">17.18. SHA</a><ul><li><a href="#sha-description">17.18.1. Description</a></li><li><a href="#sha-registration">17.18.2. Registration</a></li><li><a href="#sha-operations">17.18.3. Operations</a></li></ul></li><li><a href="#concatkdf">17.19. Concat KDF</a><ul><li><a href="#concatkdf-description">17.19.1. Description</a></li><li><a href="#concatkdf-registration">17.19.2. Registration</a></li><li><a href="#concat-params">17.19.3. ConcatParams dictionary</a></li><li><a href="#concat-operations">17.19.4. Operations</a></li></ul></li><li><a href="#hkdf-ctr">17.20. HKDF-CTR</a><ul><li><a href="#hkdf-ctr-description">17.20.1. Description</a></li><li><a href="#hkdf-ctr-registration">17.20.2. Registration</a></li><li><a href="#hkdf-ctr-params">17.20.3. HkdfCtrParams dictionary</a></li><li><a href="#hkdf2-ctr-operations">17.20.4. Operations</a></li></ul></li><li><a href="#pbkdf2">17.21. PBKDF2</a><ul><li><a href="#pbkdf2-description">17.21.1. Description</a></li><li><a href="#pbkdf2-registration">17.21.2. Registration</a></li><li><a href="#pbkdf2-params">17.21.3. Pbkdf2Params dictionary</a></li><li><a href="#pbkdf2-operations">17.21.4. Operations</a></li></ul></li></ul></li><li><a href="#algorithm-normalizing-rules">18. Algorithm normalizing rules</a></li><li><a href="#examples-section">19. JavaScript Example Code</a><ul><li><a href="#examples-signing">19.1. Generate a signing key pair, sign some data</a></li><li><a href="#examples-symmetric-encryption">19.2. Symmetric Encryption</a></li></ul></li><li><a href="#iana-section">20. IANA Considerations</a><ul><li><a href="#iana-section-jws-jwa">20.1. JSON Web Signature and Encryption Algorithms Registration</a></li><li><a href="#iana-section-jwk">20.2. JSON Web Key Parameters Registry</a></li></ul></li><li><a href="#acknowledgements-section">21. Acknowledgements</a></li><li><a href="#references">22. References</a><ul><li><a href="#normative-references">22.1. Normative References</a></li><li><a href="#informative-references">22.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 authors</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-types">11.2. Key interface data types</a></li><li><a href="#key-interface-members">11.3. Key interface members</a></li><li><a href="#key-interface-clone">11.4. Structured clone algorithm</a></li><li><a href="#key-interface-jwk">11.5. Representation using JSON Web Key</a><ul><li><a href="#key-interface-jwk-extensions">11.5.1. Extensions to JSON Web Key</a><ul><li><a href="#key-interface-jwk-algorithms">11.5.1.1. JSON Web Key algorithm names for WebCrypto algorithms</a></li><li><a href="#key-interface-jwk-ext">11.5.1.2. JSON Web Key ext attribute</a></li></ul></li><li><a href="#key-interface-jwk-mapping">11.5.2. Mapping between WebCrypto and JSON Web Key</a><ul><li><a href="#key-interface-jwk-mapping-alg">11.5.2.1. Mapping of algorithms</a></li><li><a href="#key-interface-jwk-mapping-use">11.5.2.2. Mapping of usages</a></li><li><a href="#key-interface-jwk-mapping-ext">11.5.2.3. Mapping of extractable</a></li></ul></li></ul></li></ul></li><li><a href="#crypto-interface">12. Crypto interface</a></li><li><a href="#subtlecrypto-interface">13. SubtleCrypto interface</a><ul><li><a href="#subtlecrypto-interface-description">13.1. Description</a></li><li><a href="#subtlecrypto-interface-datatypes">13.2. Data Types</a></li><li><a href="#subtlecrypto-interface-methods">13.3. Methods and Parameters</a><ul><li><a href="#SubtleCrypto-method-encrypt">13.3.1. The encrypt method</a></li><li><a href="#SubtleCrypto-method-decrypt">13.3.2. The decrypt method</a></li><li><a href="#SubtleCrypto-method-sign">13.3.3. The sign method</a></li><li><a href="#SubtleCrypto-method-verify">13.3.4. The verify method</a></li><li><a href="#SubtleCrypto-method-digest">13.3.5. The digest method</a></li><li><a href="#SubtleCrypto-method-generateKey">13.3.6. The generateKey method</a></li><li><a href="#SubtleCrypto-method-deriveKey">13.3.7. The deriveKey method</a></li><li><a href="#SubtleCrypto-method-deriveBits">13.3.8. The deriveBits method</a></li><li><a href="#SubtleCrypto-method-importKey">13.3.9. The importKey method</a></li><li><a href="#SubtleCrypto-method-exportKey">13.3.10. The exportKey method</a></li><li><a href="#SubtleCrypto-method-wrapKey">13.3.11. The wrapKey method</a></li><li><a href="#SubtleCrypto-method-unwrapKey">13.3.12. The unwrapKey method</a></li></ul></li></ul></li><li><a href="#WorkerCrypto-interface">14. WorkerCrypto interface</a><ul><li><a href="#WorkerCrypto-description">14.1. Description</a></li></ul></li><li><a href="#big-integer">15. BigInteger</a></li><li><a href="#keypair">16. KeyPair</a></li><li><a href="#algorithms">17. Algorithms</a><ul><li><a href="#algorithms-index">17.1. Registered algorithms</a></li><li><a href="#recommended-algorithms">17.2. Recommended algorithms</a></li><li><a href="#defining-an-algorithm">17.3. Defining an algorithm</a><ul><li><a href="#recognized-algorithm-name">17.3.1. Recognized algorithm name</a></li><li><a href="#supported-operations">17.3.2. Supported operations</a></li><li><a href="#algorithm-specific-params">17.3.3. Algorithm-specific parameters</a></li><li><a href="#algorithm-result">17.3.4. Algorithm results</a></li><li><a href="#algorithm-alias">17.3.5. Algorithm aliases</a></li></ul></li><li><a href="#rsaes-pkcs1">17.4. RSAES-PKCS1-v1_5</a><ul><li><a href="#rsaes-pkcs1-description">17.4.1. Description</a></li><li><a href="#rsaes-pkcs1-registration">17.4.2. Registration</a></li><li><a href="#RsaKeyGenParams-dictionary">17.4.3. RsaKeyGenParams dictionary</a></li><li><a href="#rsaes-pkcs1-operations">17.4.4. Operations</a></li></ul></li><li><a href="#rsassa-pkcs1">17.5. RSASSA-PKCS1-v1_5</a><ul><li><a href="#rsassa-pkcs1-description">17.5.1. Description</a></li><li><a href="#rsassa-pkcs1-registration">17.5.2. Registration</a></li><li><a href="#RsaSsaParams-dictionary">17.5.3. RsaSsaParams dictionary</a></li><li><a href="#rsassa-pkcs1-operations">17.5.4. Operations</a></li></ul></li><li><a href="#rsa-pss">17.6. RSA-PSS</a><ul><li><a href="#rsa-pss-description">17.6.1. Description</a></li><li><a href="#rsa-pss-registration">17.6.2. Registration</a></li><li><a href="#rsa-pss-params">17.6.3. RsaPssParams dictionary</a></li><li><a href="#rsa-pss-operations">17.6.4. Operations</a></li></ul></li><li><a href="#rsa-oaep">17.7. RSA-OAEP</a><ul><li><a href="#rsa-oaep-description">17.7.1. Description</a></li><li><a href="#rsa-oaep-registration">17.7.2. Registration</a></li><li><a href="#rsa-oaep-params">17.7.3. RsaOaepParams dictionary</a></li><li><a href="#rsa-oaep-operations">17.7.4. Operations</a></li></ul></li><li><a href="#ecdsa">17.8. ECDSA</a><ul><li><a href="#ecdsa-description">17.8.1. Description</a></li><li><a href="#ecdsa-registration">17.8.2. Registration</a></li><li><a href="#EcdsaParams-dictionary">17.8.3. EcdsaParams dictionary</a></li><li><a href="#EcKeyGenParams-dictionary">17.8.4. EcKeyGenParams dictionary</a></li><li><a href="#ecdsa-operations">17.8.5. Operations</a></li></ul></li><li><a href="#ecdh">17.9. ECDH</a><ul><li><a href="#ecdh-description">17.9.1. Description</a></li><li><a href="#ecdh-registration">17.9.2. Registration</a></li><li><a href="#dh-EcdhKeyDeriveParams">17.9.3. EcdhKeyDeriveParams dictionary</a></li><li><a href="#ecdh-operations">17.9.4. Operations</a></li></ul></li><li><a href="#aes-ctr">17.10. AES-CTR</a><ul><li><a href="#aes-ctr-description">17.10.1. Description</a></li><li><a href="#aes-ctr-registration">17.10.2. Registration</a></li><li><a href="#aes-ctr-params">17.10.3. AesCtrParams dictionary</a></li><li><a href="#aes-keygen-params">17.10.4. AesKeyGenParams dictionary</a></li><li><a href="#aes-ctr-operations">17.10.5. Operations</a></li></ul></li><li><a href="#aes-cbc">17.11. AES-CBC</a><ul><li><a href="#aes-cbc-description">17.11.1. Description</a></li><li><a href="#aes-cbc-registration">17.11.2. Registration</a></li><li><a href="#aes-cbc-params">17.11.3. AesCbcParams dictionary</a></li><li><a href="#aes-cbc-operations">17.11.4. Operations</a></li></ul></li><li><a href="#aes-cmac">17.12. AES-CMAC</a><ul><li><a href="#aes-cmac-description">17.12.1. Description</a></li><li><a href="#aes-cmac-registration">17.12.2. Registration</a></li><li><a href="#aes-cmac-operations">17.12.3. Operations</a></li></ul></li><li><a href="#aes-gcm">17.13. AES-GCM</a><ul><li><a href="#aes-gcm-description">17.13.1. Description</a></li><li><a href="#aes-gcm-registration">17.13.2. Registration</a></li><li><a href="#aes-gcm-params">17.13.3. AesGcmParams dictionary</a></li><li><a href="#aes-gcm-operations">17.13.4. Operations</a></li></ul></li><li><a href="#aes-cfb">17.14. AES-CFB</a><ul><li><a href="#aes-cfb-description">17.14.1. Description</a></li><li><a href="#aes-cfb-registration">17.14.2. Registration</a></li><li><a href="#aes-cfb-params">17.14.3. AesCfbParams dictionary</a></li><li><a href="#aes-cfb-operations">17.14.4. Operations</a></li></ul></li><li><a href="#aes-kw">17.15. AES-KW</a><ul><li><a href="#aes-kw-description">17.15.1. Description</a></li><li><a href="#aes-kw-registration">17.15.2. Registration</a></li><li><a href="#aes-kw-operations">17.15.3. Operations</a></li></ul></li><li><a href="#hmac">17.16. HMAC</a><ul><li><a href="#hmac-description">17.16.1. Description</a></li><li><a href="#hmac-registration">17.16.2. Registration</a></li><li><a href="#hmac-params">17.16.3. HmacParams dictionary</a></li><li><a href="#hmac-key-params">17.16.4. HmacKeyParams dictionary</a></li><li><a href="#hmac-operations">17.16.5. Operations</a></li></ul></li><li><a href="#dh">17.17. Diffie-Hellman</a><ul><li><a href="#dh-description">17.17.1. Description</a></li><li><a href="#dh-registration">17.17.2. Registration</a></li><li><a href="#dh-DhKeyGenParams">17.17.3. DhKeyGenParams dictionary</a></li><li><a href="#dh-DhKeyDeriveParams">17.17.4. DhKeyDeriveParams dictionary</a></li><li><a href="#dh-operations">17.17.5. Operations</a></li></ul></li><li><a href="#sha">17.18. SHA</a><ul><li><a href="#sha-description">17.18.1. Description</a></li><li><a href="#sha-registration">17.18.2. Registration</a></li><li><a href="#sha-operations">17.18.3. Operations</a></li></ul></li><li><a href="#concatkdf">17.19. Concat KDF</a><ul><li><a href="#concatkdf-description">17.19.1. Description</a></li><li><a href="#concatkdf-registration">17.19.2. Registration</a></li><li><a href="#concat-params">17.19.3. ConcatParams dictionary</a></li><li><a href="#concat-operations">17.19.4. Operations</a></li></ul></li><li><a href="#hkdf-ctr">17.20. HKDF-CTR</a><ul><li><a href="#hkdf-ctr-description">17.20.1. Description</a></li><li><a href="#hkdf-ctr-registration">17.20.2. Registration</a></li><li><a href="#hkdf-ctr-params">17.20.3. HkdfCtrParams dictionary</a></li><li><a href="#hkdf2-ctr-operations">17.20.4. Operations</a></li></ul></li><li><a href="#pbkdf2">17.21. PBKDF2</a><ul><li><a href="#pbkdf2-description">17.21.1. Description</a></li><li><a href="#pbkdf2-registration">17.21.2. Registration</a></li><li><a href="#pbkdf2-params">17.21.3. Pbkdf2Params dictionary</a></li><li><a href="#pbkdf2-operations">17.21.4. Operations</a></li></ul></li></ul></li><li><a href="#algorithm-normalizing-rules">18. Algorithm normalizing rules</a></li><li><a href="#examples-section">19. JavaScript Example Code</a><ul><li><a href="#examples-signing">19.1. Generate a signing key pair, sign some data</a></li><li><a href="#examples-symmetric-encryption">19.2. Symmetric Encryption</a></li></ul></li><li><a href="#iana-section">20. IANA Considerations</a><ul><li><a href="#iana-section-jws-jwa">20.1. JSON Web Signature and Encryption Algorithms Registration</a></li><li><a href="#iana-section-jwk">20.2. JSON Web Key Parameters Registry</a></li></ul></li><li><a href="#acknowledgements-section">21. Acknowledgements</a></li><li><a href="#references">22. References</a><ul><li><a href="#normative-references">22.1. Normative References</a></li><li><a href="#informative-references">22.2. Informative References</a></li></ul></li></ul></div>
     </div>
 
     <div id="sections">
@@ -683,25 +683,12 @@
           user agent.
         </p>
         <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-KeyType">KeyType</dfn> {
-  "secret",
-  "public",
-  "private"
-};
+typedef DOMString <a href="#dfn-KeyType">KeyType</a>;
 
-enum <dfn id="dfn-KeyUsage">KeyUsage</dfn> {
-  "encrypt",
-  "decrypt",
-  "sign",
-  "verify",
-  "deriveKey",
-  "deriveBits",
-  "wrapKey",
-  "unwrapKey"
-};
+typedef DOMString <a href="#dfn-KeyUsage">KeyUsage</a>;
 
 interface <dfn id="dfn-Key">Key</dfn> {
-  readonly attribute KeyType <a href="#dfn-Key-type">type</a>;
+  readonly attribute <a href="#dfn-KeyType">KeyType</a> <a href="#dfn-Key-type">type</a>;
   readonly attribute boolean <a href="#dfn-Key-extractable">extractable</a>;
   readonly attribute <a href="#dfn-Algorithm">Algorithm</a> <a href="#dfn-Key-algorithm">algorithm</a>;
   readonly attribute <a href="#dfn-KeyUsage">KeyUsage</a>[] <a href="#dfn-Key-usages">usages</a>;
@@ -727,15 +714,35 @@
           </p>
         </div>
 
+        <div id="key-interface-types" class="section">
+          <h3>11.2. Key interface data types</h3>
+          <dl>
+            <dt id="dfn-KeyType"><code>KeyType</code></dt>
+            <dd>The type of a key. The recognized <code>KeyType</code> values are <code>"public"</code>, <code>"private"</code> and <code>"secret"</code>.
+                Opaque keying material, including that used for symmetric algorithms, is represented by <code>"secret"</code>,
+                while keys used as part of asymmetric algorithms composed of public/private keypairs will be either
+                <code>"public"</code> or <code>"private"</code>.
+            </dd>
+            <dt id="dfn-KeyUsage"><code>KeyUsage</code></dt>
+            <dd>A type of operation that may be performed using a key. The recognized <code>KeyUsage</code> values are
+                    <code>"encrypt"</code>,
+                    <code>"decrypt"</code>,
+                    <code>"sign"</code>,
+                    <code>"verify"</code>,
+                    <code>"deriveKey"</code>,
+                    <code>"deriveBits"</code>,
+                    <code>"wrapKey"</code> and
+                    <code>"unwrapKey"</code>.
+            </dd>
+          </dl>
+        </div>
+
         <div id="key-interface-members" class="section">
-          <h3>11.2. Key interface members</h3>
+          <h3>11.3. Key interface members</h3>
           <dl>
             <dt id="dfn-Key-type"><code>type</code></dt>
             <dd>
-              The type of the underlying key. Opaque keying material, including that used for
-              symmetric algorithms, is represented by <code>"secret"</code>, while keys used as
-              part of asymmetric algorithms composed of public/private keypairs will be either
-              <code>"public"</code> or <code>"private"</code>.
+              The type of the underlying key.
             </dd>
             <dt id="dfn-Key-extractable"><code>extractable</code></dt>
             <dd>
@@ -754,7 +761,7 @@
         </div>
 
         <div id="key-interface-clone" class="section">
-          <h3>11.3. Structured clone algorithm</h3>
+          <h3>11.4. Structured clone algorithm</h3>
           <p>
             When a user agent is required to obtain a <a href="#structured-clone">structured clone</a>
             of a <a href="#dfn-Key">Key</a> object, it must run the following steps.
@@ -795,7 +802,7 @@
 
         <div id="key-interface-jwk" class="section">
         
-            <h3>11.4. Representation using JSON Web Key</h3>
+            <h3>11.5. Representation using JSON Web Key</h3>
             <p>
                 The <a href="#dfn-KeyFormat">KeyFormat</a> value <code>jwk</code> enables <a href="#dfn-Key">Key</a> objects to be imported or exported in <a href="#jwk">JSON Web Key</a> format.
             </p>
@@ -808,9 +815,9 @@
 
             </p>
             <div id="key-interface-jwk-extensions" class="section">
-              <h4>11.4.1. Extensions to JSON Web Key</h4>
+              <h4>11.5.1. Extensions to JSON Web Key</h4>
               <div id="key-interface-jwk-algorithms" class="section">
-                  <h5>11.4.1.1. JSON Web Key algorithm names for WebCrypto algorithms</h5>
+                  <h5>11.5.1.1. JSON Web Key algorithm names for WebCrypto algorithms</h5>
                   <p>
                       This specification defines additional <a href="#jwk">JSON Web Key</a> algorithm names:
                         <code>A128CTR</code>,
@@ -832,17 +839,17 @@
                   </p>
               </div>
               <div id="key-interface-jwk-ext" class="section">
-                  <h5>11.4.1.2. JSON Web Key <code>ext</code> attribute</h5>
+                  <h5>11.5.1.2. JSON Web Key <code>ext</code> attribute</h5>
                   <p>
                   This specification defines a new <a href="#jwk">JSON Web Key</a> attribute <code>ext</code> that enables the value of the <a href="#dfn-Key-extractable">extractable</a> attribute of a <a href="#dfn-Key">Key</a> to be included in a <a href="#jwk">JSON Web Key</a> object. The <code>ext</code> attribute SHALL have a Boolean value.
                   </p>
               </div>
             </div>
             <div id="key-interface-jwk-mapping" class="section">
-              <h4>11.4.2. Mapping between WebCrypto and JSON Web Key</h4>
+              <h4>11.5.2. Mapping between WebCrypto and JSON Web Key</h4>
               <p>This section defines the mapping between WebCrypto <a href="#dfn-Key">Key</a> objects and <a href="#jwk">JSON Web Key</a> objects.</p>
               <div id="key-interface-jwk-mapping-alg" class="section">
-                  <h5>11.4.2.1. Mapping of algorithms</h5>
+                  <h5>11.5.2.1. Mapping of algorithms</h5>
                   <p>The JSON Web Key <code>alg</code> member shall be mapped to / from the <code>name</code>, <code>length</code> and <code>hash</code> members of the <code>algorithm</code> attribute
                   of the Key object according to the following tables:</p>
                   <table>
@@ -1052,10 +1059,10 @@
                   </table>
               </div>
               <div id="key-interface-jwk-mapping-use" class="section">
-                <h5>11.4.2.2. Mapping of usages</h5>
+                <h5>11.5.2.2. Mapping of usages</h5>
                 <p>When exporting a WebCrypto <a href="#dfn-Key">Key</a> in JWK format, the value of the <a href="#dfn-Key">Key</a>.usages array shall be copied into the JWK <code>key_ops</code> member where each WebCryto <a href="#dfn-KeyUsage">KeyUsage</a> value maps to the JWK <code>key_ops</code> value of the same name. The <code>use</code> member shall not be present.</p>
                 <p>When importing a JWK format key into a WebCrypto <a href="#dfn-Key">Key</a> object, if the <code>key_ops</code> member is present then the
-                  WebCryto <a href="#dfn-KeyUsage">KeyUsages</a> specified by this JWK shall be equal to the values listed in <code>key_ops</code>  where each JWK <code>key_ops</code> value maps to the WebCryto <a href="#dfn-KeyUsage">KeyUsage</a> value of the same name. If the <code>key_ops</code> member is not present and the <code>use</code> member is present, then the WebCryto <a href="#dfn-KeyUsage">KeyUsages</a> specified by this JWK shall be as specified in the following table:
+                  WebCryto <a href="#dfn-KeyUsage">KeyUsages</a> specified by this JWK shall be equal to the values listed in <code>key_ops</code>  where each JWK <code>key_ops</code> value maps to the WebCryto <a href="#dfn-KeyUsage">KeyUsage</a> value of the same name, except that unrecognized values SHALL be ignored. If the <code>key_ops</code> member is not present and the <code>use</code> member is present, then the WebCryto <a href="#dfn-KeyUsage">KeyUsages</a> specified by this JWK shall be as specified in the following table:
                   </p>
                   
                   <table>
@@ -1078,7 +1085,7 @@
                   </table>
               </div>
               <div id="key-interface-jwk-mapping-ext" class="section">
-                <h5>11.4.2.3. Mapping of extractable</h5>
+                <h5>11.5.2.3. Mapping of extractable</h5>
                 <p>When exporting a WebCrypto <a href="#dfn-Key">Key</a> in JWK format, the value of the JWK <code>ext</code> attribute shall be <code>true</code>.</p>
                 <p>When importing a JWK format key into a WebCrypto <a href="#dfn-Key">Key</a> object, if the <code>ext</code> member is present then the
                   WebCryto <a href="#dfn-Key-extractable">extractable</a> value specified by this JWK shall be equal to the <code>ext</code> member value.</p>
@@ -1105,16 +1112,7 @@
       <div id="subtlecrypto-interface" class="section">
         <h2>13. SubtleCrypto 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>
-  "raw",
-  <span class="comment">// The DER encoding of the PrivateKeyInfo structure from <a href="#RFC5208">RFC 5208</a>.</span>
-  "pkcs8",
-  <span class="comment">// The DER encoding of the SubjectPublicKeyInfo structure from <a href="#RFC5280">RFC 5280</a>.</span>
-  "spki",
-  <span class="comment">// The key is represented as JSON according to the JSON Web Key format.</span>
-  "jwk",
-};
+typedef DOMString <a href="#dfn-KeyFormat"><code>KeyFormat</code></a>;
 
 typedef (ArrayBuffer or ArrayBufferView) CryptoOperationData;
 
@@ -1210,10 +1208,29 @@
           </p>
         </div>
 
+        <div id="subtlecrypto-interface-datatypes" class="section">
+          <h3>13.2. Data Types</h3>
+          <dl>
+            <dt id="dfn-KeyFormat"><code>KeyFormat</code></dt>
+            <dd>Specifies a serialization format for a key. The following values are recognized:
+              <dl>
+                <dt><code>raw</code></dt>
+                <dd>An unformatted sequence of bytes. Intended for secret keys.</dd>
+                <dt><code>pkcs8</code></dt>
+                <dd>The DER encoding of the PrivateKeyInfo structure from <a href="#RFC5208">RFC 5208</a>.</dd>
+                <dt><code>spki</code></dt>
+                <dd>The DER encoding of the SubjectPublicKeyInfo structure from <a href="#RFC5280">RFC 5280</a>.</dd>
+                <dt><code>jwk</code></dt>
+                <dd>The key is represented as JSON according to the JSON Web Key format.</dd>
+              </dl>
+            </dd>
+          </dl>
+        </div>
+
         <div id="subtlecrypto-interface-methods" class="section">
-          <h3>13.2. Methods and Parameters</h3>
+          <h3>13.3. Methods and Parameters</h3>
           <div id="SubtleCrypto-method-encrypt" class="section">
-            <h4>13.2.1. The encrypt method</h4>
+            <h4>13.3.1. The encrypt method</h4>
             <p>
               The <dfn id="dfn-SubtleCrypto-method-encrypt"><code>encrypt</code></dfn>
               method returns a new Promise object that will encrypt data using
@@ -1276,7 +1293,7 @@
           </div>
 
           <div id="SubtleCrypto-method-decrypt" class="section">
-            <h4>13.2.2. The decrypt method</h4>
+            <h4>13.3.2. The decrypt method</h4>
             <p>
               The <dfn id="dfn-SubtleCrypto-method-decrypt"><code>decrypt</code></dfn>
               method returns a new Promise object that will decrypt data using the specified
@@ -1338,7 +1355,7 @@
           </div>
 
           <div id="SubtleCrypto-method-sign" class="section">
-            <h4>13.2.3. The sign method</h4>
+            <h4>13.3.3. The sign method</h4>
             <p>
               The <dfn id="dfn-SubtleCrypto-method-sign"><code>sign</code></dfn> method
               returns a new Promise object that will sign data using the specified
@@ -1399,7 +1416,7 @@
           </div>
 
           <div id="SubtleCrypto-method-verify" class="section">
-            <h4>13.2.4. The verify method</h4>
+            <h4>13.3.4. The verify method</h4>
             <p>
               The <dfn id="dfn-SubtleCrypto-method-verify"><code>verify</code></dfn> method
               returns a new CryptoOperation object that will verify data using the specified
@@ -1460,7 +1477,7 @@
           </div>
 
           <div id="SubtleCrypto-method-digest" class="section">
-            <h4>13.2.5. The digest method</h4>
+            <h4>13.3.5. The digest method</h4>
             <p>
               The <dfn id="dfn-SubtleCrypto-method-digest"><code>digest</code></dfn> method returns
               a new Promise object that will digest data using the specified
@@ -1514,7 +1531,7 @@
           </div>
 
           <div id="SubtleCrypto-method-generateKey" class="section">
-            <h4>13.2.6. The generateKey method</h4>
+            <h4>13.3.6. The generateKey method</h4>
              <p>
               When invoked, <dfn id="dfn-SubtleCrypto-method-generateKey"><code>generateKey</code></dfn> <span class="RFC2119">MUST</span> perform the following steps:
             </p>
@@ -1536,6 +1553,12 @@
               </li>
               <li>
                 <p>
+                  If <code>keyUsages</code> includes a value that is not a recognized <a href="#dfn-KeyUsage"><code>KeyUsage</code></a> value, throw
+                  a <code>NotSupportedError</code> and <a href="#terminate-the-algorithm">terminate the algorithm</a>
+                </p>
+              </li>
+              <li>
+                <p>
                   Let <var>promise</var> be a new <code>Promise</code> object and <var>resolver</var> its associated resolver.
                 </p>
               </li>
@@ -1579,7 +1602,7 @@
           </div>
           
           <div id="SubtleCrypto-method-deriveKey" class="section">
-            <h4>13.2.7. The deriveKey method</h4>
+            <h4>13.3.7. The deriveKey method</h4>
             <p>
               When invoked, <dfn id="dfn-SubtleCrypto-method-deriveKey"><code>deriveKey</code></dfn> <span class="RFC2119">MUST</span> perform the following steps:
             </p>
@@ -1608,6 +1631,12 @@
               </li>
               <li>
                 <p>
+                  If <code>keyUsages</code> includes a value that is not a recognized <a href="#dfn-KeyUsage"><code>KeyUsage</code></a> value, throw
+                  a <code>NotSupportedError</code> and <a href="#terminate-the-algorithm">terminate the algorithm</a>
+                </p>
+              </li>
+              <li>
+                <p>
                   Let <var>promise</var> be a new <code>Promise</code> object and <var>resolver</var> its associated resolver.
                 </p>
               </li>
@@ -1658,7 +1687,7 @@
           </div>
 
           <div id="SubtleCrypto-method-deriveBits" class="section">
-            <h4>13.2.8. The deriveBits method</h4>
+            <h4>13.3.8. The deriveBits method</h4>
             <p>
               When invoked, <dfn id="dfn-SubtleCrypto-method-deriveBits"><code>deriveBits</code></dfn> <span class="RFC2119">MUST</span> perform the following steps:
             </p>
@@ -1737,7 +1766,7 @@
           </div>
 
           <div id="SubtleCrypto-method-importKey" class="section">
-            <h4>13.2.9. The <dfn id="dfn-SubtleCrypto-method-importKey">importKey</dfn> method</h4>
+            <h4>13.3.9. The <dfn id="dfn-SubtleCrypto-method-importKey">importKey</dfn> method</h4>
             <p>                  
               When invoked, the <dfn id="dfn-SubtleCrypto-method-importKey">importKey</dfn> method <span class="RFC2119">MUST</span> perform the following steps:
             </p>
@@ -1771,6 +1800,18 @@
               </li>
               <li>
                 <p>
+                  If <code>format</code> is not a recognized <a href="#dfn-KeyFormat"><code>KeyFormat</code></a> value, throw
+                  a <code>NotSupportedError</code> and <a href="#terminate-the-algorithm">terminate the algorithm</a>
+                </p>
+              </li>
+              <li>
+                <p>
+                  If <code>keyUsages</code> includes a value that is not a recognized <a href="#dfn-KeyUsage"><code>KeyUsage</code></a> value, throw
+                  a <code>NotSupportedError</code> and <a href="#terminate-the-algorithm">terminate the algorithm</a>
+                </p>
+              </li>
+              <li>
+                <p>
                   Let <var>format</var>, <var>keyData</var>, <var>extractable</var> and <var>usages</var> be the <code>format</code>, <code>keyData</code>,
                   <code>extractable</code> and <code>usages</code> parameters to the <dfn id="dfn-SubtleCrypto-method-importKey">importKey</dfn> method respectively.
                 </p>
@@ -1839,11 +1880,18 @@
           </div>
 
           <div id="SubtleCrypto-method-exportKey" class="section">
-            <h4>13.2.10. The <dfn id="dfn-SubtleCrypto-method-exportKey">exportKey</dfn> method</h4>
+            <h4>13.3.10. The <dfn id="dfn-SubtleCrypto-method-exportKey">exportKey</dfn> method</h4>
             <p>
               When invoked, the <dfn id="dfn-SubtleCrypto-method-exportKey">exportKey</dfn> method <span class="RFC2119">MUST</span> perform the following steps:
             </p>
             <ol>
+            
+              <li>
+                <p>
+                  If <code>format</code> is not a recognized <a href="#dfn-KeyFormat"><code>KeyFormat</code></a> value, throw
+                  a <code>NotSupportedError</code> and <a href="#terminate-the-algorithm">terminate the algorithm</a>
+                </p>
+              </li>
               <li>
                 <p>
                   Let <var>key</var> and <var>format</var> be the values of the <code>key</code> and <code>format</code> parameters to the
@@ -1895,7 +1943,7 @@
           </div>
 
           <div id="SubtleCrypto-method-wrapKey" class="section">
-            <h4>13.2.11. The wrapKey method</h4>
+            <h4>13.3.11. The wrapKey method</h4>
             <p>
               When invoked, the <dfn id="dfn-SubtleCrypto-method-wrapKey">wrapKey</dfn> method <span class="RFC2119">MUST</span> perform the following steps: 
             </p>
@@ -1917,6 +1965,12 @@
               </li>
               <li>
                 <p>
+                  If <code>format</code> is not a recognized <a href="#dfn-KeyFormat"><code>KeyFormat</code></a> value, throw
+                  a <code>NotSupportedError</code> and <a href="#terminate-the-algorithm">terminate the algorithm</a>
+                </p>
+              </li>
+              <li>
+                <p>
                   Let <var>promise</var> be a new <code>Promise</code> object and <var>resolver</var> its associated resolver.
                 </p>
               </li>
@@ -1987,7 +2041,7 @@
           </div>
 
           <div id="SubtleCrypto-method-unwrapKey" class="section">
-            <h4>13.2.12. The unwrapKey method</h4>
+            <h4>13.3.12. The unwrapKey method</h4>
             <p>
               When invoked, the <dfn id="dfn-SubtleCrypto-method-unwrapKey">unwrapKey</dfn> method <span class="RFC2119">MUST</span> perform the following steps: 
             </p>
@@ -2036,6 +2090,18 @@
               </li>
               <li>
                 <p>
+                  If <code>format</code> is not a recognized <a href="#dfn-KeyFormat"><code>KeyFormat</code></a> value, throw
+                  a <code>NotSupportedError</code> and <a href="#terminate-the-algorithm">terminate the algorithm</a>
+                </p>
+              </li>
+              <li>
+                <p>
+                  If <code>keyUsages</code> includes a value that is not a recognized <a href="#dfn-KeyUsage"><code>KeyUsage</code></a> value, throw
+                  a <code>NotSupportedError</code> and <a href="#terminate-the-algorithm">terminate the algorithm</a>
+                </p>
+              </li>
+              <li>
+                <p>
                   Let <var>promise</var> be a new <code>Promise</code> object and <var>resolver</var> its associated resolver.
                 </p>
               </li>
@@ -3059,14 +3125,7 @@
           <div id="EcKeyGenParams-dictionary" class="section">
             <h4>17.8.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>
-  <dfn id="dfn-NamedCurve-p256">"P-256"</dfn>,
-  <span class="comment">// NIST recommended curve P-384, also known as secp384r1.</span>
-  <dfn id="dfn-NamedCurve-p384">"P-384"</dfn>,
-  <span class="comment">// NIST recommended curve P-521, also known as secp521r1.</span>
-  <dfn id="dfn-NamedCurve-p521">"P-521"</dfn>
-};
+typedef DOMString <a href="#dfn-NamedCurve">NamedCurve</a>;
 
 dictionary <dfn id="dfn-EcKeyGenParams">EcKeyGenParams</dfn> : <a href="#dfn-Algorithm">Algorithm</a> {
   <span class="comment">// A named curve</span>
@@ -3074,8 +3133,16 @@
 };
             </code></pre></div></div>
             <p>
-              The <a href="#dfn-NamedCurve">NamedCurve</a> enumeration type represents named elliptic curves, which
-              are a convenient way to specify the domain parameters of well-known elliptic curves.
+              The <dfn id="dfn-NamedCurve">NamedCurve</dfn> type represents named elliptic curves, which
+              are a convenient way to specify the domain parameters of well-known elliptic curves. The following values are recognized:
+              <dl>
+                <dt id="dfn-NamedCurve-p256"><code>P-256</code></dt>
+                <dd>NIST recommended curve P-256, also known as <code>secp256r1</code>.</dd>
+                <dt id="dfn-NamedCurve-p2384"><code>P-384</code></dt>
+                <dd>NIST recommended curve P-384, also known as <code>secp384r1</code>.</dd>
+                <dt id="dfn-NamedCurve-p521"><code>P-521</code></dt>
+                <dd>NIST recommended curve P-521, also known as <code>secp521r1</code>.</dd>
+              </dl>
             </p>
           </div>