[EME] Bug 24419 - Clear Key: Define license request format
authorDavid Dorwin <ddorwin@google.com>
Thu, 29 May 2014 14:19:41 -0700
changeset 325 9e6c5040c5f4
parent 324 676bb18f8118
child 326 2d96fe788eb6
[EME] Bug 24419 - Clear Key: Define license request format
encrypted-media/encrypted-media.html
encrypted-media/encrypted-media.xml
--- a/encrypted-media/encrypted-media.html	Wed May 28 16:20:10 2014 -0700
+++ b/encrypted-media/encrypted-media.html	Thu May 29 14:19:41 2014 -0700
@@ -98,7 +98,7 @@
     <div class="head">
       <p><a href="http://www.w3.org/"><img src="https://www.w3.org/Icons/w3c_home" alt="W3C" width="72" height="48"></a></p>
       <h1>Encrypted Media Extensions</h1>
-      <h2 id="draft-date">W3C Editor's Draft 28 May 2014</h2>
+      <h2 id="draft-date">W3C Editor's Draft 29 May 2014</h2>
       <dl>
         <dt>This Version:</dt>
         <dd><a href="http://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted-media.html">http://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted-media.html</a></dd>
@@ -1341,21 +1341,30 @@
     <h4 id="clear-key-capabilities">Capabilities</h4>
     <p>The following describe how Clear Key supports key system-specific capabilities:</p>
     <ul>
-      <li><p>The <code><a href="#dom-loadsession">loadSession()</a></code> and "<code><a href="#dom-sessiontypepersistent">persistent</a></code>" <code><a href="#dom-sessiontype">SessionType</a></code>: Implementations may support these.</p></li>
       <li><p>The <code><a href="#dom-setmediakeys">setMediaKeys()</a></code> method: Implementations may support associating the <code><a href="#dom-mediakeys">MediaKeys</a></code> object with more than one <code><a href="#dom-htmlmediaelement">HTMLMediaElement</a></code>.</p></li>
+      <li><p>The <code><a href="#dom-setservercertificate">setServerCertificate()</a></code> method: Not supported.</p></li>
       <li><p>The <code><a href="#dom-istypesupported">isTypeSupported()</a></code> method: There are no supported <var title="true">capability</var> values.</p></li>
+      <li><p>The "<code><a href="#dom-sessiontypepersistent">persistent</a></code>" <code><a href="#dom-sessiontype">SessionType</a></code>, including the <code><a href="#dom-loadsession">loadSession()</a></code> and <code><a href="#dom-remove">remove()</a></code> methods: Implementations may support these.</p></li>
     </ul>
     
     <h4 id="clear-key-behavior">Behavior</h4>
     <p>The following describe how Clear Key implements key system-specific behaviors:</p>
     <ul>
+      <li>
+<p>In the <code><a href="#dom-createsession">createSession()</a></code> algorithm:</p>
+        <ul>
+          <li><p>The generated <var title="true">request</var> is a JSON object encoded in utf-8 as described in <a href="#clear-key-request-format">Licese Request Format</a>.</p></li>
+          <li><p>The request is generated by extracting the key IDs from the <var>init data</var>.</p></li>
+          <li><p>The "type" member value is the value of the <var title="true">sessionType</var> parameter.</p></li>
+        </ul>
+      </li>
+      <li><p>The <code><a href="#dom-sessionid">sessionId</a></code> attribute is a numerical value representable by a 32-bit integer.</p></li>
       <li><p>The <code><a href="#dom-usablekeyids">usableKeyIds</a></code> attribute is always all key IDs that have been provided via <code><a href="#dom-update">update()</a></code>.</p></li>
-      <li><p>The <code><a href="#dom-sessionid">sessionId</a></code> attribute is a numerical value representable by a 32-bit integer.</p></li>
       <li><p>The <code><a href="#dom-expiration">expiration</a></code> attribute is always <code>undefined</code>.</p></li>
       <li>
-<p>The <code><a href="#dom-update">update()</a></code> algorithm:</p>
+<p>In the <code><a href="#dom-update">update()</a></code> algorithm:</p>
         <ul>
-          <li><p>As described in <a href="#clear-key-licese-format">Licese Format</a>, the <var title="true">response</var> parameter is a JWK Set.</p></li>
+          <li><p>The <var title="true">response</var> parameter is a JWK Set as described in <a href="#clear-key-licese-format">Licese Format</a>.</p></li>
           <li><p><var>message</var> is considered invalid if it is not a valid JWK Set with at least one valid JWK key of a valid length for the media type.</p></li>
         </ul>
       </li>
@@ -1363,13 +1372,40 @@
     </ul>
 
     <h4 id="clear-key-request-format">Licese Request Format</h4>
-    TODO: <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=24419">Bug 24419</a>
+    <p>This section describes the format of the license request provided to the application via the <code><a href="#dom-message">message</a></code> attribute of the <a href="#dom-eventmessage">message</a> event.</p>
     
+    <p>The format is a JSON object containing the following members:</p>
+    <dl>
+      <dt>"kids"</dt>
+      <dd>An array of <a href="#decryption-key-id">key IDs</a>. Each element of the array is the base64url encoding of the octet sequence containing the <a href="#decryption-key-id">key ID</a> value.</dd>
+      <dt>"type"</dt>
+      <dd>The requested <code><a href="#dom-sessiontype">SessionType</a></code>
+</dd>
+    </dl>
+
+    <div class="nonnormative">
+      <p>The following example is a license request for a temporary license for two key IDs (line breaks are for readability only).</p>
+      <div class="example nonnormative">
+        <pre class="code">
+{
+  "kids": 
+    [
+     "67ef0gd8pvfd0",
+     "77ef0gd8pvfd0"
+    ],
+  "type":"<a href="#dom-sessiontypetemporary">temporary</a>"
+}</pre>
+      </div>
+    </div>
+
+    <p>When contained in the Uint8Array <code><a href="#dom-message">message</a></code> attribute of a <code><a href="#dom-mediakeymessageevent">MediaKeyMessageEvent</a></code> object, the JSON string is encoded in utf-8 as specified in the <a href="http://www.w3.org/TR/encoding/">Encoding</a> specification.
+      Applications may decode the contents of the Uint8Array to a JSON string using the <a href="http://www.w3.org/TR/encoding/#interface-textdecoder">TextDecoder interface</a>.
+    </p>
 
     <h4 id="clear-key-licese-format">Licese Format</h4>
-    <p>This section describes the format of the license to be provided via the <var title="true">response</var> parameter of <code><a href="#dom-update">update()</a></code>.</p>
+    <p>This section describes the format of the license to be provided via the <var title="true">response</var> parameter of the <code><a href="#dom-update">update()</a></code> method.</p>
 
-    <p>The format is a JSON Web Key (JWK) Set containing representation of the symmetric key to be used for decryption, as defined in the <a href="http://tools.ietf.org/html/draft-ietf-jose-json-web-key">IETF Internet-draft JSON Web Key (JWK) specification</a>. The JSON string is encoded into the Uint8Array parameter using the <a href="http://www.w3.org/TR/encoding/">Encoding API</a>.</p>
+    <p>The format is a JSON Web Key (JWK) Set containing representation of the symmetric key to be used for decryption, as defined in the <a href="http://tools.ietf.org/html/draft-ietf-jose-json-web-key">IETF Internet-draft JSON Web Key (JWK) specification</a>.</p>
 
     <p>For each JWK in the set, the parameter values are as follows:</p>
     <dl>
@@ -1378,9 +1414,9 @@
       <dt>"alg" (algorithm)</dt>
       <dd>"A128KW" (AES key wrap using a 128-bit key)</dd>
       <dt>"k" (key value)</dt>
-      <dd>base64url encoding of the octet sequence containing the symmetric <a href="#decryption-key">key</a> value</dd>
+      <dd>The base64url encoding of the octet sequence containing the symmetric <a href="#decryption-key">key</a> value</dd>
       <dt>"kid" (key ID)</dt>
-      <dd>base64url encoding of the octet sequence containing the <a href="#decryption-key-id">key ID</a> value</dd>
+      <dd>The base64url encoding of the octet sequence containing the <a href="#decryption-key-id">key ID</a> value</dd>
     </dl>
     <div class="nonnormative">
       <p>For more information on base64url and working with it, see the Base64url Encoding entry in the <a href="http://tools.ietf.org/html/draft-ietf-jose-json-web-signature#section-2">Terminology section</a> and <a href="http://tools.ietf.org/html/draft-ietf-jose-json-web-signature#appendix-C">Notes on implementing base64url encoding without padding</a> of the JSON Web Signature (JWS) specification.
@@ -1404,11 +1440,15 @@
       "alg":"A128KW",
       "k":"GawgguFyGrWKav7AX4VKUg"
       "kid":"67ef0gd8pvfd0",
-    }]
+    }],
+  "type":"<a href="#dom-sessiontypetemporary">temporary</a>"
 }</pre>
       </div>
     </div>
 
+    <p>When passed to the <code><a href="#dom-update">update()</a></code> method as the Uint8Array <var title="true">response</var> parameter, the JSON string must be encoded in utf-8 as specified in the <a href="http://www.w3.org/TR/encoding/">Encoding</a> specification.
+      Applications may encode the JSON string using the <a href="http://www.w3.org/TR/encoding/#interface-textencoder">TextEncoder interface</a>.
+    </p>
 
     <h2 id="security">6. Security Considerations</h2>
     <div class="nonnormative">
@@ -1707,7 +1747,7 @@
       var video = document.getElementById("v");
       video.src = "foo.webm";
       if (serverCertificate)
-        mediaKeys.setServerCertificate(serverCertificate);
+        mediaKeys.<a href="#dom-setservercertificate">setServerCertificate</a>(serverCertificate);
       return video.<a href="#dom-setmediakeys">setMediaKeys</a>(mediaKeys);
     }
   ).catch(
@@ -1792,7 +1832,7 @@
       var video = document.getElementById("v");
       video.src = "foo.webm";
       if (serverCertificate)
-        mediaKeys.setServerCertificate(serverCertificate);
+        mediaKeys.<a href="#dom-setservercertificate">setServerCertificate</a>(serverCertificate);
       return video.<a href="#dom-setmediakeys">setMediaKeys</a>(mediaKeys);
     }
   ).catch(
@@ -1898,7 +1938,7 @@
       mediaKeys = createdMediaKeys;
       var video = document.getElementById("v");
       if (serverCertificate)
-        mediaKeys.setServerCertificate(serverCertificate);
+        mediaKeys.<a href="#dom-setservercertificate">setServerCertificate</a>(serverCertificate);
       return video.<a href="#dom-setmediakeys">setMediaKeys</a>(mediaKeys);
     }
   ).catch(
--- a/encrypted-media/encrypted-media.xml	Wed May 28 16:20:10 2014 -0700
+++ b/encrypted-media/encrypted-media.xml	Thu May 29 14:19:41 2014 -0700
@@ -97,7 +97,7 @@
     <div class="head">
       <p><a href="http://www.w3.org/"><img src="https://www.w3.org/Icons/w3c_home" alt="W3C" width="72" height="48" /></a></p>
       <h1>Encrypted Media Extensions</h1>
-      <h2 id="draft-date">W3C Editor's Draft 28 May 2014</h2>
+      <h2 id="draft-date">W3C Editor's Draft 29 May 2014</h2>
       <dl>
         <dt>This Version:</dt>
         <dd><a href="http://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted-media.html">http://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted-media.html</a></dd>
@@ -1265,20 +1265,28 @@
     <h4 id="clear-key-capabilities">Capabilities</h4>
     <p>The following describe how Clear Key supports key system-specific capabilities:</p>
     <ul>
-      <li><p>The <methodref>loadSession</methodref> and "<coderef prefix="sessiontype">persistent</coderef>" <coderef>SessionType</coderef>: Implementations may support these.</p></li>
       <li><p>The <methodref>setMediaKeys</methodref> method: Implementations may support associating the <coderef>MediaKeys</coderef> object with more than one <coderef>HTMLMediaElement</coderef>.</p></li>
+      <li><p>The <methodref>setServerCertificate</methodref> method: Not supported.</p></li>
       <li><p>The <methodref>isTypeSupported</methodref> method: There are no supported <var title="true">capability</var> values.</p></li>
+      <li><p>The "<coderef prefix="sessiontype">persistent</coderef>" <coderef>SessionType</coderef>, including the <methodref>loadSession</methodref> and <methodref>remove</methodref> methods: Implementations may support these.</p></li>
     </ul>
     
     <h4 id="clear-key-behavior">Behavior</h4>
     <p>The following describe how Clear Key implements key system-specific behaviors:</p>
     <ul>
+      <li><p>In the <methodref>createSession</methodref> algorithm:</p>
+        <ul>
+          <li><p>The generated <var title="true">request</var> is a JSON object encoded in utf-8 as described in <a href="#clear-key-request-format">Licese Request Format</a>.</p></li>
+          <li><p>The request is generated by extracting the key IDs from the <var>init data</var>.</p></li>
+          <li><p>The "type" member value is the value of the <var title="true">sessionType</var> parameter.</p></li>
+        </ul>
+      </li>
+      <li><p>The <coderef>sessionId</coderef> attribute is a numerical value representable by a 32-bit integer.</p></li>
       <li><p>The <coderef>usableKeyIds</coderef> attribute is always all key IDs that have been provided via <methodref>update</methodref>.</p></li>
-      <li><p>The <coderef>sessionId</coderef> attribute is a numerical value representable by a 32-bit integer.</p></li>
       <li><p>The <coderef>expiration</coderef> attribute is always <code>undefined</code>.</p></li>
-      <li><p>The <methodref>update</methodref> algorithm:</p>
+      <li><p>In the <methodref>update</methodref> algorithm:</p>
         <ul>
-          <li><p>As described in <a href="#clear-key-licese-format">Licese Format</a>, the <var title="true">response</var> parameter is a JWK Set.</p></li>
+          <li><p>The <var title="true">response</var> parameter is a JWK Set as described in <a href="#clear-key-licese-format">Licese Format</a>.</p></li>
           <li><p><var>message</var> is considered invalid if it is not a valid JWK Set with at least one valid JWK key of a valid length for the media type.</p></li>
         </ul>
       </li>
@@ -1286,19 +1294,39 @@
     </ul>
 
     <h4 id="clear-key-request-format">Licese Request Format</h4>
-    TODO: <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=24419">Bug 24419</a>
-    <!--
-    <p>The <coderef>MediaKeyMessageEvent</coderef> generated by <methodref>createSession</methodref> has:</p>
-    <ul style="list-style-type:none"><li>
-      <coderef>message</coderef> = a container-specific value extracted from the <var title="true">initData</var> parameter of <methodref>createSession</methodref>. null if <var title="true">initData</var> was null or a value could not be extracted.<br></br>
-      <coderef>destinationURL</coderef> = value of the default URL if present in the <videoanchor name="media-data">media data</videoanchor> and null otherwise.
-    </li></ul>
-    -->
+    <p>This section describes the format of the license request provided to the application via the <coderef>message</coderef> attribute of the <precoderef prefix="event">message</precoderef> event.</p>
+    
+    <p>The format is a JSON object containing the following members:</p>
+    <dl>
+      <dt>"kids"</dt>
+      <dd>An array of <a href="#decryption-key-id">key IDs</a>. Each element of the array is the base64url encoding of the octet sequence containing the <a href="#decryption-key-id">key ID</a> value.</dd>
+      <dt>"type"</dt>
+      <dd>The requested <coderef>SessionType</coderef></dd>
+    </dl>
+
+    <div class="nonnormative">
+      <p>The following example is a license request for a temporary license for two key IDs (line breaks are for readability only).</p>
+      <div class="example nonnormative">
+        <pre class="code">
+{
+  "kids": 
+    [
+     "67ef0gd8pvfd0",
+     "77ef0gd8pvfd0"
+    ],
+  "type":"<precoderef prefix="sessiontype">temporary</precoderef>"
+}</pre>
+      </div>
+    </div>
+
+    <p>When contained in the Uint8Array <coderef>message</coderef> attribute of a <coderef>MediaKeyMessageEvent</coderef> object, the JSON string is encoded in utf-8 as specified in the <a href="http://www.w3.org/TR/encoding/">Encoding</a> specification.
+      Applications may decode the contents of the Uint8Array to a JSON string using the <a href="http://www.w3.org/TR/encoding/#interface-textdecoder">TextDecoder interface</a>.
+    </p>
 
     <h4 id="clear-key-licese-format">Licese Format</h4>
-    <p>This section describes the format of the license to be provided via the <var title="true">response</var> parameter of <methodref>update</methodref>.</p>
+    <p>This section describes the format of the license to be provided via the <var title="true">response</var> parameter of the <methodref>update</methodref> method.</p>
 
-    <p>The format is a JSON Web Key (JWK) Set containing representation of the symmetric key to be used for decryption, as defined in the <a href="http://tools.ietf.org/html/draft-ietf-jose-json-web-key">IETF Internet-draft JSON Web Key (JWK) specification</a>. The JSON string is encoded into the Uint8Array parameter using the <a href="http://www.w3.org/TR/encoding/">Encoding API</a>.</p>
+    <p>The format is a JSON Web Key (JWK) Set containing representation of the symmetric key to be used for decryption, as defined in the <a href="http://tools.ietf.org/html/draft-ietf-jose-json-web-key">IETF Internet-draft JSON Web Key (JWK) specification</a>.</p>
 
     <p>For each JWK in the set, the parameter values are as follows:</p>
     <dl>
@@ -1307,9 +1335,9 @@
       <dt>"alg" (algorithm)</dt>
       <dd>"A128KW" (AES key wrap using a 128-bit key)</dd>
       <dt>"k" (key value)</dt>
-      <dd>base64url encoding of the octet sequence containing the symmetric <a href="#decryption-key">key</a> value</dd>
+      <dd>The base64url encoding of the octet sequence containing the symmetric <a href="#decryption-key">key</a> value</dd>
       <dt>"kid" (key ID)</dt>
-      <dd>base64url encoding of the octet sequence containing the <a href="#decryption-key-id">key ID</a> value</dd>
+      <dd>The base64url encoding of the octet sequence containing the <a href="#decryption-key-id">key ID</a> value</dd>
     </dl>
     <div class="nonnormative">
       <p>For more information on base64url and working with it, see the Base64url Encoding entry in the <a href="http://tools.ietf.org/html/draft-ietf-jose-json-web-signature#section-2">Terminology section</a> and <a href="http://tools.ietf.org/html/draft-ietf-jose-json-web-signature#appendix-C">Notes on implementing base64url encoding without padding</a> of the JSON Web Signature (JWS) specification.
@@ -1333,11 +1361,15 @@
       "alg":"A128KW",
       "k":"GawgguFyGrWKav7AX4VKUg"
       "kid":"67ef0gd8pvfd0",
-    }]
+    }],
+  "type":"<precoderef prefix="sessiontype">temporary</precoderef>"
 }</pre>
       </div>
     </div>
 
+    <p>When passed to the <methodref>update</methodref> method as the Uint8Array <var title="true">response</var> parameter, the JSON string must be encoded in utf-8 as specified in the <a href="http://www.w3.org/TR/encoding/">Encoding</a> specification.
+      Applications may encode the JSON string using the <a href="http://www.w3.org/TR/encoding/#interface-textencoder">TextEncoder interface</a>.
+    </p>
 
     <h2 id="security">6. Security Considerations</h2>
     <div class="nonnormative">
@@ -1634,7 +1666,7 @@
       var video = document.getElementById("v");
       video.src = "foo.webm";
       if (serverCertificate)
-        mediaKeys.setServerCertificate(serverCertificate);
+        mediaKeys.<premethodref>setServerCertificate</premethodref>(serverCertificate);
       return video.<premethodref>setMediaKeys</premethodref>(mediaKeys);
     }
   ).catch(
@@ -1719,7 +1751,7 @@
       var video = document.getElementById("v");
       video.src = "foo.webm";
       if (serverCertificate)
-        mediaKeys.setServerCertificate(serverCertificate);
+        mediaKeys.<premethodref>setServerCertificate</premethodref>(serverCertificate);
       return video.<premethodref>setMediaKeys</premethodref>(mediaKeys);
     }
   ).catch(
@@ -1825,7 +1857,7 @@
       mediaKeys = createdMediaKeys;
       var video = document.getElementById("v");
       if (serverCertificate)
-        mediaKeys.setServerCertificate(serverCertificate);
+        mediaKeys.<premethodref>setServerCertificate</premethodref>(serverCertificate);
       return video.<premethodref>setMediaKeys</premethodref>(mediaKeys);
     }
   ).catch(