diff --git a/encrypted-media-respec.html b/encrypted-media-respec.html index c4b7bb08..f760deae 100644 --- a/encrypted-media-respec.html +++ b/encrypted-media-respec.html @@ -131,18 +131,18 @@

The working group maintains a list of all bug reports that the editors have not yet tried to address; there are also open bugs in the previous bug tracker. This draft highlights some of the pending issues that are still to be discussed in the working group. No decision has been taken on the outcome of these issues including whether they are valid.

Implementors should be aware that this specification is not stable. Implementors who are not taking part in the discussions are likely to find the specification changing out from under them in incompatible ways. Vendors interested in implementing this specification before it eventually reaches the Candidate Recommendation stage should join the mailing list mentioned below and take part in the discussions.

-

Bug 20944 - The specification should do more to encourage/ensure CDM-level interoperability.

-

This specification contains sections for describing security and privacy considerations. These sections are not final and review is welcome.

+

Issue 192 - The specification should do more to encourage/ensure CDM-level interoperability.

+

Issue 221 - This specification contains sections for describing security and privacy considerations. These sections are not final and review is welcome.

- - +

Introduction

@@ -327,33 +327,90 @@

Definitions

+
Non-Associable Identifiers
+
+

Two identifiers or other values are said to be non-associable if they are not identical AND it is not possible - with a reasonable amount of time and effort - to correlate or associate them. + Otherwise, two values are associable. +

+

Implementation MUST NOT expose identifiers to applications, even in encrypted form, across origins or across clearing of identifiers.

+ +
+

For example, two values that are completely unrelated or cryptographically distinct, such as via a cryptographically strong non-reversible hash function, are .

+

As counter examples, values created in the following ways are :

+
    +
  • Using a trivially-reversible hash function.

  • +
  • Sharing a prefix or other subset

  • +
  • Replacing random value N with N+10

  • +
  • XORing the origin with a fixed value (because it is trivially reversible)

  • +
+
+
+
Distinctive Identifier
-

Issue 117 - The definition of Distinctive Identifier needs to be refined and will likely change.

+

+ A distinctive identifier is a value for which it is possible to associate the values outside the device across a) origins or b) browsing sessions even after the user has attempted to protect his or her privacy by clearing browsing data or it is not easy for a user to break such association. + In particular, a value is a distinctive identifier if it is possible for a central server, such as an individualization server, to associate values across origins, such as because the individualization requests contained a common value, or because values provided in individualization requests are even after attempts to clear browsing data. + Possible causes of this include use of hardware or other indelible IDs in the individualization process. +

A distinctive identifier is a piece of data, implication of the possession of a piece of data, or an observable behavior or timing for which all of the following criteria hold:

-

A distinctive identifier is typically unique to a user or device, but an identifier does not need to be strictly unique to be distinctive. +

While a distinctive identifier is typically unique to a user or device, an identifier does not need to be strictly unique to be distinctive. For example, an identifier shared among a small number of users could still be distinctive.

Examples of distinctive identifiers include but are not limited to:

    -
  • A string of bytes that is included in key requests and that is different from the string included by other devices.

  • -
  • A public key included in key requests that is different from the public keys included in the requests by other devices.

  • -
  • Demonstration of possession of a private key (e.g. by signing some data) that other devices do not have.

  • +
  • A series of bytes that is included in key requests, different from the series of bytes included by other devices, and based on or was acquired directly or indirectly using an indelible identifier.

  • +
  • A public key included in key requests that is different from the public keys included in the requests by other devices and is based on or was acquired directly or indirectly using an indelible identifier.

  • +
  • Demonstration of possession of a private key (e.g. by signing some data) that other devices do not have and is based on or was acquired directly or indirectly using an indelible identifier.

  • An identifier for such a key.

  • +
  • Such a value used to derive another value that is exposed even though the first value is not directly exposed.

  • +
  • A value derived from another distinctive identifier.

-

Examples of things that are not distinctive identifiers:

+

Examples of things that are not distinctive identifiers:

  • A public key shared among all copies of a given CDM version if the installed base is large.

  • -
  • A nonce or ephemeral key that is unique but used in only one session.

  • +
  • A nonce or ephemeral key that is unique but used in only one session.

  • +
  • A value that is not exposed, even in derived or similar ways, outside the client, including via individualization or similar.

  • Device-unique keys used in attestations between, for example, the video pipeline and the CDM when the CDM does not let these attestations further flow to the application and instead makes a new attestation on its own using a key that does not constitute a distinctive identifier.

  • +
  • +

    A value that is fully cleared/clearable along with browsing data, such as cookies, after which it will be replaced by a value AND one or more of the following:

    +
      +
    • No indelible value or distinctive identifier was involved in the generation of the value.

    • +
    • It is a random value generated without inputs from the system.

    • +
    • It is a value provided by a server without the use of or knowledge of another distinctive identifier.

    • +
    +

The source of the identifier does not affect whether it is distinctive. @@ -611,7 +668,7 @@

Get Supported Configuration and Consent
-

If the implementation requires a in combination with accumulated configuration and restrictions, return NotSupported.

+

If the implementation requires use of a in combination with accumulated configuration and restrictions, return NotSupported.

@@ -735,7 +792,7 @@
Get Supported Configuration and Consent
  • If accumulated configuration's value is , follow the steps for the first matching condition from the following list:

    -
    If the implementation requires a for any of the combinations in accumulated configuration
    +
    If the implementation requires use of a for any of the combinations in accumulated configuration

    Change accumulated configuration's value to .

    @@ -957,8 +1014,8 @@
    Get Consent Status

    The member of accumulated configuration is not and any of the recommendations of - Allow Identifiers to be Cleared are not supported by the combination of the - User Agent, implementation and accumulated configuration. + Allow Identifiers to Be Cleared or Allow Persistent Data to Be Cleared + are not supported by the combination of the User Agent, implementation and accumulated configuration.

  • @@ -1069,8 +1126,14 @@

    MediaKeySystemConfiguration dictionary

    MediaKeysRequirement distinctiveIdentifier = "optional"
    - Whether a persistent is required. -

    Messages from the CDM, such as events, MUST NOT contain a , even in an encrypted form, when this member is . + Whether use of a is required. +

    when this member is , the implementation MUST NOT use or expose a for any operations associated with any object created from this configuration. + This includes but is not limited to the following: +

    +
      +
    1. Any individualization process MUST NOT use and messages involved MUST NOT contain a Distinctive Identifier.

    2. +
    3. Messages from the CDM, such as events, MUST NOT contain a , even in an encrypted form.

    4. +
    MediaKeysRequirement persistentState = "optional"
    @@ -1229,7 +1292,7 @@

    MediaKeys Interface

    temporary

    - A session for which the license and record of or data related to the session MUST NOT be persisted. + A session for which the license, key(s) and record of or data related to the session are not persisted.

    The application need not worry about managing such storage. @@ -1240,7 +1303,7 @@

    MediaKeys Interface

    Issue 85 - There are concerns about the architectural implications of "persistent-usage-record" sessions that are pending a TAG discussion. The outcome of this discussion could result in modification (including removal) of the feature.

    - A session for which the license and any key(s) it contains SHALL NOT be persisted and for which a SHALL be persisted when + A session for which the license and key(s) are not persisted and for which a is persisted when the keys available within the session are destroyed. The record of key usage consists of:

    @@ -1411,13 +1474,13 @@

    CDM Unavailable

    The following step is run:

    1. -

      For each MediaKeySession created by the media keys on which the algorithm has not been run, run the algorithm.

      +

      For each MediaKeySession created by the media keys on which the algorithm has not been run, to run the algorithm.

  • -

    Storage and persistence

    +

    Storage and Persistence

    This section describes general requirements related to storage and persistence.

    @@ -1449,6 +1512,13 @@

    MediaKeySession Interface

    The algorithm MUST be run in parallel to the main event loop, but not in parallel to other procedures defined in this specification that are also defined to be run in parallel.

    +

    + If a MediaKeySession object becomes inaccessible to the page + and the algorithm has not already been run, the User Agent + MUST run the algorithm before User Agent state + associated with the session is deleted. +

    +

    A MediaKeySession object SHALL NOT be destroyed and SHALL continue to receive events if it has not been closed and the MediaKeys object that created it remains accessible. Otherwise, @@ -1833,7 +1903,7 @@

    MediaKeySession Interface

    1. - Close the session and clear all stored session data associated with this object, + Close the session and clear all stored session data associated with this object, including the and license destruction record.

      A subsequent call to with the value of this object's would fail because there is no data stored for that session ID.

      @@ -1847,7 +1917,7 @@

      MediaKeySession Interface

      1. - Close the session and clear all stored session data associated with this object, + Close the session and clear all stored session data associated with this object, including the and the .

        A subsequent call to with the value of this object's would fail because there is no data stored for that session ID.

        @@ -2058,16 +2128,17 @@

        MediaKeyStatusMap Interface

        The MediaKeyStatusMap object is a read-only map of key IDs to the current status of the associated key.

        A key's status is independent of whether the key is currently being used and of media data.

        For example, if a key has output requirements that cannot currently be met, the key's status should be or , as appropriate, regardless of whether that key has been or is currently needed to decrypt media data.

        -

        Issue 75 - The exact behavior of the iterable declaration is still being determined and may change in incompatible ways. This includes the definition of the value pairs and the ForEachCallback parameters.

        iterable <BufferSource, MediaKeyStatus>
        - The value pairs to iterate over are a snapshot of the set of pairs formed from the and - associated MediaKeyStatus value for all known keys, sorted by , - where for Key IDs A and B, of lengths n and m respectively, with n <= m, then we - define A < B if and only if the n octets of A are less in lexicographical - order than the first n octets of B or those octets are equal and n < m. +

        + The value pairs to iterate over are a snapshot of the set of pairs formed from the and + associated MediaKeyStatus value for all known keys, sorted by , + where for Key IDs A and B, of lengths n and m respectively, with n <= m, then we + define A < B if and only if the n octets of A are less in lexicographical + order than the first n octets of B or those octets are equal and n < m. +

        readonly attribute unsigned long size
        @@ -2092,22 +2163,6 @@

        MediaKeyStatusMap Interface

        The of the key.
        - -
        void forEach()
        -
        -

        Calls callback once for each key-value pair present in the MediaKeyStatus map.

        -
        -
        ForEachCallback callback
        -
        A callback function
        -
        -
        - - -
        -
        BufferSource keyId
        -
        The .
        -
        MediaKeyStatus status
        -
        The key status.
        @@ -2269,6 +2324,7 @@

        Update Key Statuses

        The Update Key Statuses algorithm updates the set of known keys for a MediaKeySession or the status of one or more of the keys. Requests to run this algorithm include a target MediaKeySession object and a sequence of and associated MediaKeyStatus pairs.

        +

        The algorithm is always run in a task.

        The following steps are run:

        1. Let the session be the associated MediaKeySession object.

        2. @@ -2299,6 +2355,7 @@

          Update Expiration

          The Update Expiration algorithm updates the expiration time of a MediaKeySession. Requests to run this algorithm include a target MediaKeySession object and the new expiration time, which may be NaN.

          +

          The algorithm is always run in a task.

          The following steps are run:

          1. Let the session be the associated MediaKeySession object.

          2. @@ -2311,6 +2368,7 @@

            Update Expiration

            Session Closed

            The Session Closed algorithm updates the MediaKeySession state after a session has been closed.

            +

            The algorithm is always run in a task.

            Closing a session means that the license(s) and key(s) associated with it are no longer available to decrypt . All MediaKeySession methods will fail and no further events will be queued for this object @@ -2334,7 +2392,7 @@

            Session Closed

          3. If session's session type is , - store the record of key usage, if it exists. + store session's record of key usage, if it exists.

            The record of key usage may not exist if no keys have been used in the session or if it has been deleted as @@ -2347,15 +2405,36 @@

            Session Closed

          4. Resolve promise.

    - +
    +

    MediaKeySession Destroyed

    +

    + This algorithm performs steps that are necessary when a MediaKeySession is destroyed and + the algorithm has not been run. +

    +

    The following steps are run in parallel to the main event loop:

    +
      +
    1. Let session be the associated MediaKeySession object.

    2. +
    3. Let cdm be the CDM instance represented by session's cdm instance value.

    4. +
    5. Use cdm to close the session associated with session.

      +
    6. +

      + If session's session type is , + store session's record of key usage, if it exists. +

      +

      + Since it has no effects observable to the document, this step may be run asynchronously, including after the document has unloaded. +

      +
    7. +
    +

    Monitor for CDM State Changes

    The Monitor for CDM State Changes algorithm executes steps required when various aspects of CDM state change. It is run for each MediaKeySession object in parallel to the main event loop but not in parallel to other procedures defined in this specification that are run in parallel to the main event loop. -

    This algorithm only applies to CDM state changes that are not covered by other algorithms. For example, may result in messages, key status changes and/or expiration changes, but those are all handled within that algorithm.

    +

    This algorithm only applies to CDM state changes that are not covered by other algorithms. For example, may result in messages, key status changes and/or expiration changes, but those are all handled within that algorithm.

    The following steps are run:

    @@ -2497,6 +2576,9 @@

    Session Storage and Persistence

    Specifically, the CDM SHOULD NOT store session data during the algorithm. This ensures that the application is aware of the session and knows it needs to eventually remove it.

    +

    All data associated with a session MUST be cleared when the session is cleared, such as in when processing a license destruction acknowledgement or key usage record acknowledgement. + See Persistent Data. +

    The CDM MUST ensure that data for a given session is only present in one active unclosed session in any . In other words, MUST fail when there is already a MediaKeySession representing the session specified by the sessionId parameter, either because the object that created it via is still active or it has been loaded into another object via . A session MAY only be loaded again after the algorithm has not been run on the object representing it. @@ -2788,7 +2870,7 @@

    Attempt to Decrypt

    MediaKeySession object containing that key and let block key be that key.

    If multiple sessions contain a key that is for the block key ID, which session and key to use is -dependent.

    -
  • If the status of any of the available keys changed as the result of running the preceding step, run the algorithm on each affected session, providing all key ID(s) in the session along with the appropriate MediaKeyStatus value(s) for each. +

  • If the status of any of the available keys changed as the result of running the preceding step, to run the algorithm on each affected session, providing all key ID(s) in the session along with the appropriate MediaKeyStatus value(s) for each.

  • If block key is not null, run the following steps:

    1. @@ -2965,7 +3047,7 @@

      Allow Persistent Data to Be Cleared

      Implementations that use persistent data MUST allow the user to clear that data such that it is no longer retrievable both outside, such as via the APIs defined in this specification, and on the client device.

      -

      +

      Implementations SHOULD allow users to clear persistent data along with cookies [[!COOKIES]] and other site data. It is RECOMMENDED that users be offered the option to clear persistent data as part of user agent features to clear browsing history.

      @@ -3007,7 +3089,7 @@

      Encrypt Identifiers

      The encryption MUST ensure that the ciphertext cannot be used as a proxy for the actual identifier, even given the same plaintext. The CDM MUST verify that the encryption key belongs to a valid license server for its Key System.

      -

      Add more specific text about ensuring the desired privacy properties when encrypting identifiers.

      +

      Issue 219 - Add more specific text about ensuring the desired privacy properties when encrypting identifiers.

      This MAY be implemented using a server certificate.

      The license server MUST NOT expose a to any entity other than the CDM that sent it.

      Specifically, it should not be provided to the application or included unencrypted in messages to the CDM. @@ -3030,19 +3112,19 @@

      Use Per-Origin Identifiers

      Issue 101 - It has been suggested that the be distinctive for the combination of top-level origin and the origin using these APIs.

      -

      - It MUST NOT be possible (with a reasonable amount of time and effort) to correlate identifiers from multiple origins, such as to determine that they came from the same client or user. +

      + Values across origins MUST be , meaning it MUST NOT be possible to correlate identifiers from multiple origins, such as to determine that they came from the same client or user. Specifically, implementations that derive per-origin identifiers from an origin-independent identifier, MUST do so in a non-reversible way.

      -

      Add more specific text about ensuring the desired non-reversible properties.

      +

      Issue 219 - Add more specific text about ensuring the desired non-reversible properties.

  • Allow Identifiers to Be Cleared

    -

    As a consequence of the requirements in Allow Persistent Data to Be Cleared, implementations that use Distinctive Identifier(s) MUST allow the user to clear those identifiers such that they are no longer retrievable both outside, such as via the APIs defined in this specification, and on the client device. +

    As a consequence of the requirements in Allow Persistent Data to Be Cleared, implementations that use Distinctive Identifier(s) MUST allow the user to clear those identifiers such that they are no longer retrievable both outside, such as via the APIs defined in this specification, and on the client device.

    - Once cleared, new different values MUST be generated when Distinctive Identifier(s) are subsequently needed. + Once cleared, new values MUST be generated when Distinctive Identifier(s) are subsequently needed.

    @@ -3571,7 +3653,7 @@

    Concerns

    In addition, if a Key System permits keys to be stored and to be re-used between origins, then it may be possible for two origins to collude and track a unique user by recording their ability to access a common key.

    Finally, if any user interface for user control of Key Systems presents data separately from data in HTTP session cookies [[COOKIES]] or persistent storage, then users are likely to modify site authorization or delete data in one and not the others. - This would allow sites to use the various features as redundant backup for each other, defeating a user's attempts to protect his privacy. + This would allow sites to use the various features as redundant backup for each other, defeating a user's attempts to protect his or her privacy.

    The following section describes techniques that may mitigate the risks of tracking without user consent.

    @@ -3593,11 +3675,11 @@

    Mitigations

    -
    Use of (non-reversible) per-origin identifiers
    +
    Use of non-associable per-origin identifiers
    - -

    Implementations that use MUST use a different value for each , either by allocation of different identifiers for different origins or by use of a non-reversible origin-specific mapping from an origin-independent identifier. - See Use Per-Origin Identifiers and non-reversible identifiers. + +

    Implementations that use MUST use a different value for each . + See Use Per-Origin Identifiers.

    @@ -3611,7 +3693,7 @@

    Mitigations

    Blocking third-party access
    - +

    User agents MAY restrict access to Key Systems and/or features to scripts originating at the of the top-level of the browsing context. For example, may deny requests for certain configurations for pages from other origins running in iframes.

    @@ -3672,7 +3754,7 @@

    Mitigations

    While these suggestions prevent trivial use of this API for user tracking, they do not block it altogether. Within a single origin, a site can continue to track the user during a session, and can then pass all this information to a third party along with any identifying information (names, credit card numbers, addresses) obtained by the site. - If a third party cooperates with multiple sites to obtain such information, and if identifiers are not unique per-origin, then a profile can still be created. + If a third party cooperates with multiple sites to obtain such information, and if identifiers are not unique per-origin, then a profile can still be created.

    @@ -3698,7 +3780,7 @@
    Origin-Independent Individualization

    The resulting identifier MUST be origin- and application-independent. Such identifiers MUST NOT be provided to applications (see Use Per-Origin Identifiers), even encrypted. - Implementations MAY derive non-reversible per-origin identifiers from such identifiers and provide those to the application (encrypted) + Implementations MAY derive per-origin identifiers from such identifiers and provide those to the application (encrypted).

    For such individualization, all message exchanges:

    -
  • 5.3 Storage and persistence
  • +
  • 5.3 Storage and Persistence
  • 6. MediaKeySession Interface @@ -1079,7 +1094,6 @@

  • 6.3.1 Attributes
  • 6.3.2 Methods
  • -
  • 6.3.3 Callback ForEachCallback Parameters
  • 6.4 MediaKeyMessageEvent @@ -1100,7 +1114,8 @@

    6.6.2 Update Key Statuses

  • 6.6.3 Update Expiration
  • 6.6.4 Session Closed
  • -
  • 6.6.5 Monitor for CDM State Changes
  • +
  • 6.6.5 MediaKeySession Destroyed
  • +
  • 6.6.6 Monitor for CDM State Changes
  • 6.7 Exceptions
  • @@ -1276,7 +1291,6 @@

    1. Introduction

    @@ -1446,11 +1460,42 @@

    +
    Non-Associable Identifiers
    +
    +

    Two identifiers or other values are said to be non-associable if they are not identical AND it is not possible - with a reasonable amount of time and effort - to correlate or associate them. Otherwise, two values are associable. +

    +

    Implementation MUST NOT expose associable identifiers to applications, even in encrypted form, across origins or across clearing of identifiers.

    + +
    +
    Note
    +
    +

    For example, two values that are completely unrelated or cryptographically distinct, such as via a cryptographically strong non-reversible hash function, are non-associable.

    +

    As counter examples, values created in the following ways are associable:

    +
      +
    • +

      Using a trivially-reversible hash function.

      +
    • +
    • +

      Sharing a prefix or other subset

      +
    • +
    • +

      Replacing random value N with N+10

      +
    • +
    • +

      XORing the origin with a fixed value (because it is trivially reversible)

      +
    • +
    +
    +
    +
    +
    Distinctive Identifier
    -
    -
    Issue 3
    -

    Issue 117 - The definition of Distinctive Identifier needs to be refined and will likely change.

    +
    +
    Note
    +

    + A distinctive identifier is a value for which it is possible to associate the values outside the device across a) origins or b) browsing sessions even after the user has attempted to protect his or her privacy by clearing browsing data or it is not easy for a user to break such association. In particular, a value is a distinctive identifier if it is possible for a central server, such as an individualization server, to associate values across origins, such as because the individualization requests contained a common value, or because values provided in individualization requests are associable even after attempts to clear browsing data. Possible causes of this include use of hardware or other indelible IDs in the individualization process. +

    A distinctive identifier is a piece of data, implication of the possession of a piece of data, or an observable behavior or timing for which all of the following criteria hold:

      @@ -1458,55 +1503,115 @@

      It is not shared across a large population of users or devices.

    • -

      It is exposed outside the client device or exposed to the application such that the application has the opportunity to send it (even if in encrypted form if decryptable outside the device) or information about it outside the client device.

      +

      It, information about it, or values derived or otherwise related to it are exposed, even in encrypted form, outside the client. This includes but is not limited to providing it to the application and/or license, individualization, or other server. +

    • -

      It is used in more than one session or - is potentially used in one persistent session across the point of persistence.

      +

      It has one or more the following properties:

      +
        +
      • +

        It is derived from a value that is indelible in some way, including but not limited to hardware, operating system installation instance, or client or other user account values.

        +
      • +
      • +

        The generation, individualization, provisioning or other process that produced the value involved, used, provided, derived from, or similarly involved such an indelible value or another distinctive identifier.

        +
      • +
      • +

        It is clearable but not along with cookies and other site data.

        +
        +
        Note
        +

        For example, via some mechanism external to the user agent, such as an OS-level mechanism.

        +
        +
      • +
      +
      +
      Note
      +
      +

      Other properties of concern that are normatively prohibited include:

      + +
      +
    -
    Note
    -

    A distinctive identifier is typically unique to a user or device, but an identifier does not need to be strictly unique to be distinctive. For example, an identifier shared among a small number of users could still be distinctive. +

    Note
    +

    While a distinctive identifier is typically unique to a user or device, an identifier does not need to be strictly unique to be distinctive. For example, an identifier shared among a small number of users could still be distinctive.

    -
    Note
    +
    Note

    Examples of distinctive identifiers include but are not limited to:

    • -

      A string of bytes that is included in key requests and that is different from the string included by other devices.

      +

      A series of bytes that is included in key requests, different from the series of bytes included by other devices, and based on or was acquired directly or indirectly using an indelible identifier.

    • -

      A public key included in key requests that is different from the public keys included in the requests by other devices.

      +

      A public key included in key requests that is different from the public keys included in the requests by other devices and is based on or was acquired directly or indirectly using an indelible identifier.

    • -

      Demonstration of possession of a private key (e.g. by signing some data) that other devices do not have.

      +

      Demonstration of possession of a private key (e.g. by signing some data) that other devices do not have and is based on or was acquired directly or indirectly using an indelible identifier.

    • An identifier for such a key.

    • +
    • +

      Such a value used to derive another value that is exposed even though the first value is not directly exposed.

      +
    • +
    • +

      A value derived from another distinctive identifier.

      +
    -

    Examples of things that are not distinctive identifiers:

    +

    Examples of things that are not distinctive identifiers:

    • A public key shared among all copies of a given CDM version if the installed base is large.

    • -

      A nonce or ephemeral key that is unique but used in only one - session.

      +

      A nonce or ephemeral key that is unique but used in only one session.

      +
    • +
    • +

      A value that is not exposed, even in derived or similar ways, outside the client, including via individualization or similar.

    • Device-unique keys used in attestations between, for example, the video pipeline and the CDM when the CDM does not let these attestations further flow to the application and instead makes a new attestation on its own using a key that does not constitute a distinctive identifier.

    • +
    • +

      A value that is fully cleared/clearable along with browsing data, such as cookies, after which it will be replaced by a non-associable value AND one or more of the following:

      +
        +
      • +

        No indelible value or distinctive identifier was involved in the generation of the value.

        +
      • +
      • +

        It is a random value generated without inputs from the system.

        +
      • +
      • +

        It is a value provided by a server without the use of or knowledge of another distinctive identifier.

        +
      • +
      +
    -
    Note
    +
    Note

    The source of the identifier does not affect whether it is distinctive. For example, an identifier that is permanently part of the client device, contained in the CDM, generated on the client, or generated as part of some individualization or other provisioning process is considered distinctive if it meets the criteria above.

    @@ -1557,7 +1662,7 @@

    requestMediaKeySystemAccess
    -
    Note
    +
    Note

    Calling this method may have user-visible effects, including requests for user consent. This method should only be called when the author intends to create and use a MediaKeys object with the provided configuration.

    @@ -1617,15 +1722,15 @@

    incumbent settings object is not a secure context [POWERFUL-FEATURES], run the following steps:

    -
    -
    Issue 4
    +
    +
    Issue 3

    Support for communication from Secure Contexts to devices on a private network is an open issue. A bug will be filed with the Web Application Security Working Group and referenced here.

    1. If the result of running the Are insecure contexts allowed? algorithm is Allowed, skip the next step.

      -
      Note
      +
      Note

      This step is DEPRECATED. It is expected that removal of this step will be evaluated during Candidate Recommendation (CR). Authors are advised that implementations MAY remove it before then.

      @@ -1633,7 +1738,7 @@

      NotSupportedError.

      -
      Note
      +
      Note

      Requiring Secure Contexts is not a replacement for other security- and privacy-related requirements and recommendations. Implementations MUST meet all related requirements and SHOULD follow related recommendations such that the risks on in an secure context would be similar.

      @@ -1693,7 +1798,7 @@

      NotSupportedError.

      -
      Note
      +
      Note

      keySystem was not supported/allowed or none of the configurations in supportedConfigurations were supported/allowed.

    2. @@ -1714,12 +1819,12 @@

      3.1.2.1 Get Supported Configuration

      Given a Key Systems implementation implementation, MediaKeySystemConfiguration candidate configuration, and origin, this algorithm returns a supported configuration or NotSupported as appropriate.

      -
      Note
      +
      Note

      Unrecognized dictionary members in candidate configuration are ignored per [WebIDL] and will never reach this algorithm. Thus, they cannot be considered as part of the configuration.

      -
      Note
      +
      Note

      For certain configurations, it may be required to obtain user consent or inform the user. User Agents have some flexibility to determine whether consent is required for a specific configuration and whether such consent may also apply to other configurations. For example, consent to one configuration may also imply consent for less powerful, more restricted configurations. Equally, a denial of consent for one configuration may imply denial of consent for more powerful, less restricted configurations. @@ -1793,7 +1898,7 @@

      @@ -1842,11 +1947,11 @@
      -
      Note
      +
      Note

      For example, if audio/video type is Video and the top-level type is not "video" or media types contains non-video codecs.

      @@ -2166,7 +2271,7 @@
      media data for the combination of container, media types, robustness and local accumulated configuration in combination with restrictions:

      -
      Note
      +
      Note

      requested media capability (content type and robustness) must be supported with all previously added requested media capabilities.

        @@ -2175,7 +2280,7 @@
        -
        Note
        +
        Note

        This step ensures that the values of the members of entries in supported media capabilities are exactly the strings supplied in requested media capability without modification by the User Agent. @@ -2198,7 +2303,7 @@

        -
        Note
        +
        Note

        This step ensures that configurations are always checked with configurations from previous iterations, including from previous calls to this algorithm. Otherwise, only configurations from previous calls to this algorithm would be checked in subsequent calls.

        @@ -2211,7 +2316,7 @@
        -
        Note
        +
        Note

        None of the MediaKeySystemMediaCapability elements in requested media capabilities is supported in combination with partial configuration.

    @@ -2234,7 +2339,7 @@

    distinctiveIdentifier of type MediaKeysRequirement, defaulting to "optional"
    - Whether a persistent Distinctive Identifier is required. -

    Messages from the CDM, such as message events, MUST NOT contain a Distinctive Identifier, even in an encrypted form, when this member is "not-allowed". + Whether use of a Distinctive Identifier is required. +

    when this member is "not-allowed", the implementation MUST NOT use or expose a Distinctive Identifier for any operations associated with any object created from this configuration. This includes but is not limited to the following:

    +
      +
    1. +

      Any individualization process MUST NOT use and messages involved MUST NOT contain a Distinctive Identifier.

      +
    2. +
    3. +

      Messages from the CDM, such as message events, MUST NOT contain a Distinctive Identifier, even in an encrypted form.

      +
    4. +
    initDataTypes of type sequence<DOMString>, defaulting to [ ]
    A list of supported Initialization Data Type names. The Initialization Data Type capability of this object is considered supported if the list is empty or contains one or more values that are supported with all other members (as determined by the algorithm). Values in the sequence MUST not be the empty string. @@ -2417,16 +2530,16 @@

    MUST NOT persist any state related to the application or origin of this object's Document when this member is "not-allowed".

    -
    Note
    +
    Note

    For the purposes of this member, persistent state does not include persistent unique identifiers (Distinctive Identifiers) controlled by the Key System implementation. distinctiveIdentifier independently reflects this requirement.

    Only "temporary" sessions may be created when persistent state is not supported.

    -
    Note
    +
    Note

    For "temporary" sessions, the need and ability to store state is Key System implementation-specific and may vary by feature used.

    -
    Note
    +
    Note

    Applications intending to create non-"temporary" sessions, should set this member to "required" when calling requestMediaKeySystemAccess().

    sessionTypes of type sequence<DOMString>
    @@ -2443,7 +2556,7 @@

    SHOULD NOT add members to the this dictionary. Should member(s) be added, they MUST be of type MediaKeysRequirement, and it is RECOMMENDED that they have default values of "optional" to support the widest range of application and client combinations.

    -
    Note
    +
    Note

    Dictionary members not recognized by a user agent implementation are ignored per [WebIDL] and will not be considered in the requestMediaKeySystemAccess() algorithm. Should an application use non-standard dictionary member(s), it MUST NOT rely on user agent implementations rejecting a configuration that includes such dictionary members.

    @@ -2472,7 +2585,7 @@

    contentType MUST NOT be the empty string and its entire value, including all codecs, MUST be supported with robustness.

    -
    Note
    +
    Note

    If any of a set of codecs is acceptable, use a separate instances of this dictionary for each codec.

    @@ -2536,7 +2649,7 @@

    -
    Note
    +
    Note

    The value of distinctive identifier requirement cannot be "optional".

    @@ -2556,7 +2669,7 @@

    -
    Note
    +
    Note

    The value of persistent state requirement cannot be "optional".

    @@ -2626,7 +2739,7 @@

    configuration value.

    -
    Note
    +
    Note

    This results in a new JavaScript object being created and initialized from configuration each time this method is called.

    @@ -2662,7 +2775,7 @@

    temporary

    - A session for which the license and record of or data related to the session MUST NOT be persisted. + A session for which the license, key(s) and record of or data related to the session are not persisted.

    The application need not worry about managing such storage. Support for this session type is REQUIRED. @@ -2672,12 +2785,12 @@

    persistent-usage-record -
    -
    Issue 5
    +
    +
    Issue 4

    Issue 85 - There are concerns about the architectural implications of "persistent-usage-record" sessions that are pending a TAG discussion. The outcome of this discussion could result in modification (including removal) of the feature.

    - A session for which the license and any key(s) it contains SHALL NOT be persisted and for which a record of key usage SHALL be persisted when the keys available within the session are destroyed. The record of key usage consists of: + A session for which the license and key(s) are not persisted and for which a record of key usage is persisted when the keys available within the session are destroyed. The record of key usage consists of:

    • @@ -2701,13 +2814,13 @@

      key usage accuracy is implementation-dependant but SHALL NOT be greater than 60 seconds.

      -
      Note
      +
      Note

      Because the license and keys are not persisted, this record implicitly proves that the keys are no longer available in the session.

      -
      Note
      +
      Note

      User agents MAY implement this mechanism by means other than persisting data on key destruction - for example by persisting data during playback which is later used to infer the fact of key destruction - provided the observable behavior is compliant to this specification.

      @@ -2777,14 +2890,14 @@

      If this object's supported session types value does not contain sessionType, throw a NotSupportedError.

      -
      Note
      +
      Note

      sessionType values for which the Is persistent session type? algorithm returns true will fail if this object's persistent state allowed value is false.

    • If the implementation does not support MediaKeySession operations in the current state, throw an InvalidStateError.

      -
      Note
      +
      Note

      Some implementations are unable to execute MediaKeySession algorithms until this MediaKeys object is associated with a media element using setMediaKeys(). This step enables applications to detect this uncommon behavior before attempting to perform such operations.

      @@ -2838,7 +2951,7 @@

      Provides a server certificate to be used to encrypt messages to the license server.

      Key Systems that use such certificates MUST also support requesting the certificate from the server via the Queue a "message" Event algorithm.

      -
      Note
      +
      Note

      This method allows an application to proactively provide a server certificate to implementations that support it to avoid the additional round trip should the CDM request it. It is intended as an optimization, and applications are not required to use it.

      @@ -2938,14 +3051,14 @@

      MediaKeySession created by the media keys on which the Session Closed algorithm has not been run, run the Session Closed algorithm.

      +

      For each MediaKeySession created by the media keys on which the Session Closed algorithm has not been run, queue a task to run the Session Closed algorithm.

    • -

      5.3 Storage and persistence

      +

      5.3 Storage and Persistence

      This section describes general requirements related to storage and persistence.

      @@ -2973,11 +3086,16 @@

      The User Agent SHALL execute the Monitor for CDM Changes algorithm continuously for each MediaKeySession object until the sooner of the Session Closed algorithm being run or the destruction of the MediaKeySession. The Monitor for CDM Changes algorithm MUST be run in parallel to the main event loop, but not in parallel to other procedures defined in this specification that are also defined to be run in parallel.

      +

      + If a MediaKeySession object becomes inaccessible to the page and the Session Closed algorithm has not already been run, the User Agent + MUST run the MediaKeySession destroyed algorithm before User Agent state associated with the session is deleted. +

      +

      A MediaKeySession object SHALL NOT be destroyed and SHALL continue to receive events if it has not been closed and the MediaKeys object that created it remains accessible. Otherwise, a MediaKeySession object that is no longer accessible to JavaScript SHALL NOT receive further events and MAY be destroyed.

      -
      Note
      +
      Note

      The above rule implies that the CDM instance must not be destroyed until all MediaKeys objects and all MediaKeySession objects associated with the CDM instance are destroyed.

      @@ -3010,7 +3128,7 @@

      The time after which the key(s) in the session will no longer be usable for decryption, or NaN if no such time exists or if the license explicitly never expires, as determined by the CDM.

      -
      Note
      +
      Note

      This value MAY change during the session lifetime, such as when an action triggers the start of a window.

    keyStatuses of type MediaKeyStatusMap, readonly
    @@ -3018,12 +3136,12 @@

    A reference to a read-only map of key IDs known to the session to the current status of the associated key. Each entry MUST have a unique key ID.

    -
    Note
    +
    Note

    The map entries and their values may be updated whenever the event loop spins. The map MUST NOT ever be inconsistent or partially updated, but it may change between accesses if the event loop spins in between the accesses. Key IDs may be added as the result of a load() or update() call. Key IDs may be removed as the result of a update() call that removes knowledge of existing keys (or replaces the existing set of keys with a new set). Key IDs MUST NOT be removed because they became unusable, such as due to expiration. Instead, such keys MUST be given an appropriate status, such as "expired".

    -
    Note
    +
    Note

    Some older platforms may contain Key System implementations that do not expose key IDs, making it impossible to provide a compliant user agent implementation. To maximize interoperability, user agent implementations exposing such CDMs SHOULD implement this member as follows: Whenever a non-empty list is appropriate, such as when the key session represented by this object may contain key(s), populate the map with a single pair containing the one-byte key ID 0 and the MediaKeyStatus most appropriate for the aggregated status of this object.

    @@ -3047,7 +3165,7 @@

    Indicates that the application no longer needs the session and the CDM should release any resources associated with the session and close it. Persisted data should not be released or cleared.

    -
    Note
    +
    Note

    The returned promise is resolved when the request has been processed, and the closed attribute promise is resolved when the session is closed.

    @@ -3077,7 +3195,7 @@

    Use cdm to close the session associated with session.

    -
    Note
    +
    Note

    Closing the key session results in the destruction of any license(s) and key(s) that have not been explicitly stored.

    @@ -3090,7 +3208,7 @@

    Resolve promise.

    -
    Note
    +
    Note

    Since promise handlers are queued as microtasks, these will be executed ahead of any events queued by the preceding steps.

    @@ -3209,7 +3327,7 @@

    Let requested license type be a temporary non-persistable license.

    -
    Note
    +
    Note

    The returned license must not be persistable or require persisting information related to it.

    @@ -3286,8 +3404,8 @@

    In a subsequent call to update() the CDM MUST generate a license request for the requested license type based on the sanitized init data, which is interpreted per initDataType.

    -
    -
    Issue 6
    +
    +
    Issue 5

    Issue 207 proposes that the above requirement be formally described in terms of CDM state that will trigger the generation of a license request in a future call to update().

    @@ -3322,7 +3440,7 @@

    Resolve promise.

    -
    Note
    +
    Note

    Since promise handlers are queued as microtasks, these will be executed ahead of any events queued by the preceding steps.

    @@ -3392,7 +3510,7 @@

    Let sanitized session ID be a validated and/or sanitized version of sessionId.

    -
    Note
    +
    Note

    The user agent should thoroughly validate the sessionId value before passing it to the CDM. At a minimum, this should include checking that the length and value (e.g. alphanumeric) are reasonable.

    @@ -3403,7 +3521,7 @@

    If there is an unclosed session in this object's Document whose sessionId attribute is sanitized session ID, reject promise with a QuotaExceededError.

    -
    Note
    +
    Note

    In other words, do not create a session if a non-closed session, regardless of type, already exists for this sanitized session ID in this browsing context.

    @@ -3435,7 +3553,7 @@

    If there is an unclosed session in any Document representing the session data, reject promise with a QuotaExceededError.

    -
    Note
    +
    Note

    In other words, do not create a session if a non-closed persistent session already exists for this sanitized session ID in any browsing context.

    @@ -3488,7 +3606,7 @@

    Resolve promise with true.

    -
    Note
    +
    Note

    Since promise handlers are queued as microtasks, these will be executed ahead of any events queued by the preceding steps.

    @@ -3546,7 +3664,7 @@

    -
    Note
    +
    Note

    This implies destruction of the license(s) and/or keys(s) whether they are in memory, persistent store or both.

    @@ -3621,7 +3739,7 @@

    Resolve promise.

    -
    Note
    +
    Note

    Since promise handlers are queued as microtasks, these will be executed ahead of any events queued by the preceding steps.

    @@ -3684,7 +3802,7 @@

    Let sanitized response be a validated and/or sanitized version of response copy.

    -
    Note
    +
    Note

    The user agent should thoroughly validate the response before passing it to the CDM. This may include verifying values are within reasonable limits, stripping irrelevant data or fields, pre-parsing it, sanitizing it, and/or generating a fully sanitized version. The user agent should check that the length and values of fields are reasonable. Unknown fields should be rejected or removed.

    @@ -3716,7 +3834,7 @@

    If sanitized response contains a license or key(s)
    -
    Note
    +
    Note

    This includes an initial license, an updated license, and a license renewal message.

    Process sanitized response, following the stipulation for the first matching condition from the following list:

    @@ -3749,15 +3867,15 @@

    See also Session Storage and Persistence.

    State information, including keys, for each session MUST be stored in such a way that closing one session does not affect the observable state in other session(s), even if they contain overlapping key IDs.

    -
    Note
    +
    Note

    When sanitized response contains key(s) and/or related data, cdm will likely store (in memory) the key and related data indexed by key ID.

    -
    Note
    +
    Note

    The replacement algorithm within a session is Key System-dependent.

    -
    Note
    +
    Note

    It is RECOMMENDED that CDM implementations support a standard and reasonably high minimum number of keys per MediaKeySession object, including a standard replacement algorithm, and a standard and reasonably high minimum number of MediaKeySession objects. This enables a reasonable number of key rotation algorithms to be implemented across user agents and may reduce the likelihood of playback interruptions in use cases that involve various streams in the same element (i.e. adaptive streams, various audio and video tracks) using different keys.

    @@ -3768,10 +3886,10 @@

  • - Close the session and clear all stored session data associated with this object, including the sessionId and license destruction record. + Close the session and clear all stored session data associated with this object, including the sessionId and license destruction record.

    -
    Note
    +
    Note

    A subsequent call to load() with the value of this object's sessionId would fail because there is no data stored for that session ID.

  • @@ -3786,10 +3904,10 @@

  • - Close the session and clear all stored session data associated with this object, including the sessionId and the record of key usage. + Close the session and clear all stored session data associated with this object, including the sessionId and the record of key usage.

    -
    Note
    +
    Note

    A subsequent call to load() with the value of this object's sessionId would fail because there is no data stored for that session ID.

  • @@ -3801,7 +3919,7 @@

    Otherwise
    Process sanitized response, not storing any session data.
    -
    Note
    +
    Note

    For example, sanitized response may contain information that will be used to generate another message event. In this case, there is no need to verify the contents against the sessionType.

    @@ -3858,7 +3976,7 @@

    Resolve promise.

    -
    Note
    +
    Note

    Since promise handlers are queued as microtasks, these will be executed ahead of any events queued by the preceding steps.

    @@ -3879,23 +3997,20 @@

    The MediaKeyStatusMap object is a read-only map of key IDs to the current status of the associated key.

    A key's status is independent of whether the key is currently being used and of media data.

    -
    Note
    +
    Note

    For example, if a key has output requirements that cannot currently be met, the key's status should be "output-downscaled" or "output-restricted", as appropriate, regardless of whether that key has been or is currently needed to decrypt media data.

    -
    -
    Issue 7
    -

    Issue 75 - The exact behavior of the iterable declaration is still being determined and may change in incompatible ways. This includes the definition of the value pairs and the ForEachCallback parameters.

    -
    interface MediaKeyStatusMap {
         iterable<BufferSource,MediaKeyStatus>;
         readonly        attribute unsigned long size;
         boolean        has (BufferSource keyId);
         MediaKeyStatus get (BufferSource keyId);
    -    void           forEach (ForEachCallback callback);
     };

    This interface has "entries", "keys", "values", "forEach" and @@iterator methods brought by iterable.

    - The value pairs to iterate over are a snapshot of the set of pairs formed from the key ID and associated MediaKeyStatus value for all known keys, sorted by key ID, where for Key IDs A and B, of lengths n and m respectively, with n <= m, then we define A < B if and only if the n octets of A are less in lexicographical order than the first n octets of B or those octets are equal and n < m. +

    + The value pairs to iterate over are a snapshot of the set of pairs formed from the key ID and associated MediaKeyStatus value for all known keys, sorted by key ID, where for Key IDs A and B, of lengths n and m respectively, with n <= m, then we define A < B if and only if the n octets of A are less in lexicographical order than the first n octets of B or those octets are equal and n < m. +

    @@ -3909,32 +4024,7 @@

    6.3.2 Methods

    -
    forEach
    -
    -

    Calls callback once for each key-value pair present in the MediaKeyStatus map.

    - - - - - - - - - - - - - - - - - - -
    ParameterTypeNullableOptionalDescription
    callbackForEachCallback - - ✘✘A callback function
    -
    Return type: void
    -
    get
    +
    get

    Returns the MediaKeyStatus of the key identified by keyId or undefined if the status of the key identified by keyId is not known.

    @@ -3986,16 +4076,6 @@

    -
    callback ForEachCallback = void (BufferSource keyId, MediaKeyStatus status);
    - -
    -

    6.3.3 Callback ForEachCallback Parameters

    -
    keyId of type BufferSource
    -
    The key ID.
    status of type MediaKeyStatus
    -
    The key status.
    -
    -
    -
    enum MediaKeyStatus {
         "usable",
         "expired",
    @@ -4146,7 +4226,7 @@ 

    Implementations MUST NOT require applications to handle message types. Implementations MUST support applications that do not differentiate messages and MUST NOT require that applications handle message types. Specifically, Key Systems MUST support passing all types of messages to a single URL.

    -
    Note
    +
    Note

    This attribute allows an application to differentiate messages without parsing the message. It is intended to enable optional application and/or server optimizations, but applications are not required to use it.

    @@ -4232,6 +4312,10 @@

    6.6.2 Update Key Statuses

    The Update Key Statuses algorithm updates the set of known keys for a MediaKeySession or the status of one or more of the keys. Requests to run this algorithm include a target MediaKeySession object and a sequence of key ID and associated MediaKeyStatus pairs.

    +
    +
    Note
    +

    The algorithm is always run in a task.

    +

    The following steps are run:

    1. @@ -4262,7 +4346,7 @@

    -
    Note
    +
    Note

    The effect of this steps is that the contents of session's keyStatuses attribute are replaced without invalidating existing references to the attribute. This replacement is atomic from a script perspective. That is, script MUST NOT ever see a partially populated sequence.

    @@ -4280,6 +4364,10 @@

    6.6.3 Update Expiration

    The Update Expiration algorithm updates the expiration time of a MediaKeySession. Requests to run this algorithm include a target MediaKeySession object and the new expiration time, which may be NaN.

    +
    +
    Note
    +

    The algorithm is always run in a task.

    +

    The following steps are run:

    1. @@ -4300,11 +4388,15 @@

      6.6.4 Session Closed

      The Session Closed algorithm updates the MediaKeySession state after a session has been closed.

      +
      +
      Note
      +

      The algorithm is always run in a task.

      +

      Closing a session means that the license(s) and key(s) associated with it are no longer available to decrypt media data. All MediaKeySession methods will fail and no further events will be queued for this object after this algorithm is run.

      -
      Note
      +
      Note

      The CDM may close a session at any point, such as when the session is no longer needed or when system resources are lost. In that case, the Monitor for CDM Changes algorithm detects the change and runs this algorithm. @@ -4323,10 +4415,10 @@

    2. - If session's session type is "persistent-usage-record", store the record of key usage, if it exists. + If session's session type is "persistent-usage-record", store session's record of key usage, if it exists.

      -
      Note
      +
      Note

      The record of key usage may not exist if no keys have been used in the session or if it has been deleted as a result of the update() method processing an acknowledgement of the record of key usage.

      @@ -4347,17 +4439,46 @@

      +
      +

      6.6.5 MediaKeySession Destroyed

      +

      + This algorithm performs steps that are necessary when a MediaKeySession is destroyed and the Session Closed algorithm has not been run. +

      +

      The following steps are run in parallel to the main event loop:

      +
        +
      1. +

        Let session be the associated MediaKeySession object.

        +
      2. +
      3. +

        Let cdm be the CDM instance represented by session's cdm instance value.

        +
      4. +
      5. +

        Use cdm to close the session associated with session.

        +
      6. +
      7. +

        + If session's session type is "persistent-usage-record", store session's record of key usage, if it exists. +

        +
        +
        Note
        +

        + Since it has no effects observable to the document, this step may be run asynchronously, including after the document has unloaded. +

        +
        +
      8. +
      +
      +
      -

      6.6.5 Monitor for CDM State Changes

      +

      6.6.6 Monitor for CDM State Changes

      The Monitor for CDM State Changes algorithm executes steps required when various aspects of CDM state change. It is run for each MediaKeySession object in parallel to the main event loop but not in parallel to other procedures defined in this specification that are run in parallel to the main event loop.

      -
      Note
      +
      Note

      This algorithm only applies to CDM state changes that are not covered by other algorithms. For example, update() may result in messages, key status changes and/or expiration changes, but those are all handled within that algorithm.

      -

      The following steps are run:

      @@ -4483,6 +4604,8 @@

      Is persistent session type? algorithm returns true.

      The CDM SHOULD NOT store session data, including the Session ID, until update() is called the first time. Specifically, the CDM SHOULD NOT store session data during the generateRequest() algorithm. This ensures that the application is aware of the session and knows it needs to eventually remove it.

      +

      All data associated with a session MUST be cleared when the session is cleared, such as in update() when processing a license destruction acknowledgement or key usage record acknowledgement. See Persistent Data. +

      The CDM MUST ensure that data for a given session is only present in one active unclosed session in any Document. In other words, load() MUST fail when there is already a MediaKeySession representing the session specified by the sessionId parameter, either because the object that created it via generateRequest() is still active or it has been loaded into another object via load(). A session MAY only be loaded again after the Session Closed algorithm has not been run on the object representing it.

      An application that creates a session using a type for which the Is persistent session type? algorithm returns true SHOULD later remove the stored data using remove(). The CDM MAY also remove sessions as appropriate, but applications SHOULD NOT rely on this. @@ -4524,7 +4647,7 @@

      For each block of encrypted media data encountered during the resource fetch algorithm, the user agent shall run the Encrypted Block Encountered algorithm in the order the encrypted blocks were encountered.

      -
      Note
      +
      Note

      The above step provides flexibility for user agent implementations to perform decryption at any time after an encrypted block is encountered before it is needed for playback.

    3. @@ -4565,11 +4688,11 @@

      Provides the MediaKeys to use when decrypting media data during playback.

      -
      Note
      +
      Note

      Support for clearing or replacing the associated MediaKeys object during playback is a quality of implementation issue. In many cases it will result in a bad user experience or rejected promise.

      -
      Note
      +
      Note

      Some implementations may only support decrypting media data provided via Media Source Extensions [MEDIA-SOURCE]. This is not reflected in the results of calling requestMediaKeySystemAccess().

      @@ -4630,7 +4753,7 @@

      If the association cannot currently be removed, let this object's attaching media keys value be false and reject promise with an InvalidStateError.

      -
      Note
      +
      Note

      For example, some implementations may not allow removal during playback.

    4. @@ -4787,7 +4910,7 @@

      The user agent encounters Initialization Data in the media data. The element's readyState is equal to HAVE_METADATA or greater.
      -
      Note
      +
      Note

      It is possible that the element is playing or has played.

      @@ -4827,7 +4950,7 @@

    -
    Note
    +
    Note

    While the media element may allow loading of "Optionally-blockable Content" [MIXED-CONTENT], the user agent MUST NOT expose Initialization Data from such media data to the application.

    @@ -4842,11 +4965,11 @@

    -
    Note
    +
    Note

    readyState is not changed and no algorithms are aborted. This event merely provides information.

    -
    Note
    +
    Note

    The initData attribute will be null if the media data is not CORS-same-origin or is mixed content. Applications may retrieve the Initialization Data from an alternate source.

    @@ -4854,7 +4977,7 @@

    If the media element's mediaKeys attribute is null and the implementation requires specification of a MediaKeys object before decoding potentially-encrypted media data, run the following steps:

    -
    Note
    +
    Note

    These steps may be reached when the application provides media data before calling setMediaKeys() to provide a MediaKeys object. Selecting a CDM may affect the pipeline and/or decoders used, so some implementations may delay playback of media data that may contain encrypted blocks until a CDM is specified by passing a MediaKeys object to setMediaKeys().

    @@ -4909,7 +5032,7 @@

    -
    Note
    +
    Note

    These steps are intended to be run on unrecoverable failures of the CDM.

      @@ -4927,7 +5050,7 @@

      MediaKeySession created by the media keys on which the Session Closed algorithm has not been run, run the following steps:

      -
      Note
      +
      Note

      This check ensures the cdm has finished loading and is a prerequisite for a matching key being available.

        @@ -4937,7 +5060,7 @@

        -
        Note
        +
        Note

        The key ID is generally specified by the container.

    @@ -4954,12 +5077,12 @@

    usable for decryption, let session be a MediaKeySession object containing that key and let block key be that key.

    -
    Note
    +
    Note

    If multiple sessions contain a key that is usable for decryption for the block key ID, which session and key to use is Key System-dependent.

  • -

    If the status of any of the available keys changed as the result of running the preceding step, run the Update Key Statuses algorithm on each affected session, providing all key ID(s) in the session along with the appropriate MediaKeyStatus value(s) for each. +

    If the status of any of the available keys changed as the result of running the preceding step, queue a task to run the Update Key Statuses algorithm on each affected session, providing all key ID(s) in the session along with the appropriate MediaKeyStatus value(s) for each.

  • @@ -4985,7 +5108,7 @@

    -
    Note
    +
    Note

    Implementations MAY optimize the times at which this step is executed provided the recorded key usage times remain accurate to within key usage accuracy.

    @@ -5021,7 +5144,7 @@

    -
    Note
    +
    Note

    In other words, decode the block.

  • @@ -5033,13 +5156,13 @@

    -
    Note
    +
    Note

    Not all decryption problems (i.e. using the wrong key) will result in a decryption failure. In such cases, no error is fired here but one may be fired during decode.

    -
    Note
    +
    Note

    Otherwise, there is no key for the block key ID in any session so continue.

    @@ -5052,7 +5175,7 @@

    -
    Note
    +
    Note

    These steps are reached when there is no key that is usable for decryption for block.

      @@ -5064,7 +5187,7 @@

      -
      Note
      +
      Note

      For frame-based encryption, this may be implemented as follows when the media element attempts to decode a frame as part of the resource fetch algorithm:

        @@ -5107,7 +5230,7 @@

        Set the media element's waiting for key value to true.

        -
        Note
        +
        Note

        As a result of the above step, the media element will become a blocked media element if it wasn't already. In that case, the media element will stop playback.

        @@ -5145,7 +5268,7 @@

        -
        Note
        +
        Note

        As a result of the above step, the media element may no longer be a blocked media element and thus playback may resume.

      @@ -5155,7 +5278,7 @@

      HAVE_ENOUGH_DATA as appropriate.

      -
      Note
      +
      Note

      States beyond HAVE_CURRENT_DATA and the canplaythrough event do not (or are unlikely to) consider key availability beyond the current key. @@ -5197,7 +5320,7 @@

      MUST allow the user to clear that data such that it is no longer retrievable both outside, such as via the APIs defined in this specification, and on the client device.

      -

      +

      Implementations SHOULD allow users to clear persistent data along with cookies [COOKIES] and other site data. It is RECOMMENDED that users be offered the option to clear persistent data as part of user agent features to clear browsing history.

      @@ -5217,14 +5340,14 @@

      SHOULD avoid use of Distinctive Identifiers.

      -
      Note
      +
      Note

      For example, use keys or identifiers that apply to a group of clients or devices rather than individual clients.

    1. Implementations SHOULD only use Distinctive Identifiers when necessary to enforce the policies related to the specific CDM instance and session.

      -
      Note
      +
      Note

      For example, "temporary" and "persistent-license" sessions may have different requirements.

    2. @@ -5239,19 +5362,19 @@

      8.2.2 Encrypt Identifiers

      When exposed to the application - either from a message event or a message from the server, such as one that is passed to update() - Distinctive Identifiers MUST be encrypted at the message exchange level. The encryption MUST ensure that the ciphertext cannot be used as a proxy for the actual identifier, even given the same plaintext. The CDM MUST verify that the encryption key belongs to a valid license server for its Key System.

      -
      -
      Issue 8
      -

      Add more specific text about ensuring the desired privacy properties when encrypting identifiers.

      +
      +
      Issue 6
      +

      Issue 219 - Add more specific text about ensuring the desired privacy properties when encrypting identifiers.

      This MAY be implemented using a server certificate.

      The license server MUST NOT expose a Distinctive Identifier to any entity other than the CDM that sent it.

      -
      Note
      +
      Note

      Specifically, it should not be provided to the application or included unencrypted in messages to the CDM. This can be accomplished by encrypting the identifier or message with the identifier or such that it is only decryptable by that specific CDM.

      -
      Note
      +
      Note

      Among other things, this means that:

        @@ -5273,26 +5396,26 @@

        8.2.3 Use Per-Origin Identifiers

        All Distinctive Identifiers MUST be distinctive per origin. That is, the Distinctive Identifier(s) used for one origin using these APIs MUST be different from those used for any other origin using the APIs.

        -
        -
        Issue 9
        +
        +
        Issue 7

        Issue 101 - It has been suggested that the Distinctive Identifiers be distinctive for the combination of top-level origin and the origin using these APIs.

        -

        - It MUST NOT be possible (with a reasonable amount of time and effort) to correlate identifiers from multiple origins, such as to determine that they came from the same client or user. Specifically, implementations that derive per-origin identifiers from an origin-independent identifier, MUST do so in a non-reversible way. +

        + Values across origins MUST be non-associable, meaning it MUST NOT be possible to correlate identifiers from multiple origins, such as to determine that they came from the same client or user. Specifically, implementations that derive per-origin identifiers from an origin-independent identifier, MUST do so in a non-reversible way.

        -
        -
        Issue 10
        -

        Add more specific text about ensuring the desired non-reversible properties.

        +
        +
        Issue 8
        +

        Issue 219 - Add more specific text about ensuring the desired non-reversible properties.

        8.2.4 Allow Identifiers to Be Cleared

        -

        As a consequence of the requirements in Allow Persistent Data to Be Cleared, implementations that use Distinctive Identifier(s) MUST allow the user to clear those identifiers such that they are no longer retrievable both outside, such as via the APIs defined in this specification, and on the client device. +

        As a consequence of the requirements in Allow Persistent Data to Be Cleared, implementations that use Distinctive Identifier(s) MUST allow the user to clear those identifiers such that they are no longer retrievable both outside, such as via the APIs defined in this specification, and on the client device.

        - Once cleared, new different values MUST be generated when Distinctive Identifier(s) are subsequently needed. + Once cleared, new non-associable values MUST be generated when Distinctive Identifier(s) are subsequently needed.

        @@ -5301,7 +5424,7 @@

        8.3 Support Multiple Keys

        Implementations MUST support multiple keys in each MediaKeySession object.

        -
        Note
        +
        Note

        The mechanics of how multiple keys are supported is an implementation detail, but it MUST be transparent to the application and these APIs.

        @@ -5316,7 +5439,7 @@

        8.4.1 Licenses Generated are Independent of Content Type

        Implementations SHOULD allow licenses generated with any Initialization Data Type they support to be used with any content type.

        -
        Note
        +
        Note

        Otherwise, the requestMediaKeySystemAccess() algorithm might, for example, reject a MediaKeySystemConfiguration because one of the initDataTypes is not supported with one of the videoCapabilities.

        @@ -5325,7 +5448,7 @@

        8.4.2 Support Extraction From Media Data

        For any supported Initialization Data Type that may appear in a supported container, the user agents MUST support extracting that type of Initialization Data from each such supported container.

        -
        Note
        +
        Note

        In other words, indicating support for an Initialization Data Type implies both CDM support for generating license requests and, for container-specific types, user agent support for extracting it from the container. This does not mean that implementations must be able to parse any supported Initialization Data from any supported content type.

        @@ -5349,7 +5472,7 @@

        Media resources, including all tracks, MUST be encrypted and packaged per a container-specific "common encryption" specification that allows the content to be decrypted in a fully specified and compatible way when a key or keys are provided.

        -
        Note
        +
        Note

        The Encrypted Media Extensions Stream Format and Initialization Data Format Registry [EME-STREAM-REGISTRY] provides references to such stream formats.

        @@ -5362,7 +5485,7 @@

        SHOULD NOT be encrypted.

        -
        Note
        +
        Note

        Decryption of such tracks - especially such that they can be provided back the user agent - is not generally supported by implementations. Thus, encrypting such tracks would prevent them from being widely available for use with accessibility features in user agent implementations.

        @@ -5382,7 +5505,7 @@

        -
        Note
        +
        Note

        This ensures that there is a common baseline level of functionality that is guaranteed to be supported in all user agents, including those that are entirely open source. Thus, content providers that need only basic decryption can build simple applications that will work on all platforms without needing to work with any content protection providers.

        @@ -5631,13 +5754,13 @@

        User Agent and Key System implementations MUST consider media data, Initialization Data, data passed to update(), licenses, key data, and all other data provided by the application as untrusted content and potential attack vectors. They MUST use appropriate safeguards to mitigate any associated threats and take care to safely parse, decrypt, etc. such data. User Agents SHOULD validate data before passing it to the CDM.

        -
        Note
        +
        Note

        Such validation is especially important if the CDM does not run in the same (sandboxed) context as, for example, the DOM.

        Implementations MUST NOT return active content or passive content that affects program control flow to the application.

        -
        Note
        +
        Note

        For example, it is not safe to expose URLs or other information that may have come from media data, such as is the case for the Initialization Data passed to generateRequest(). Applications must determine the URLs to use. The messageType attribute of the message event can be used by the application to select among a set of URLs if applicable.

        @@ -5650,7 +5773,7 @@

        Exploiting a CDM implementation that is not fully sandboxed and/or uses platform features may allow an attacker to access OS or platform features, elevate privilege (e.g. to run as system or root), and/or access drivers, kernel, firmware, hardware, etc. Such features, software, and hardware may not be written to be robust against hostile software or web-based attacks and may not be updated with security fixes, especially compared to the user agent. Lack of, infrequent, or slow updates for fixes to security vulnerabilities in CDM implementations increases the risk. Such CDM implementations and UAs that expose them MUST be especially careful in all areas of security, including parsing of all data.

        -
        Note
        +
        Note

        User agents should be especially diligent when using a CDM or underlying mechanism that is part of or provided by the client OS, platform and/or hardware.

        @@ -5658,7 +5781,7 @@

        If a user agent chooses to support a Key System implementation that cannot be sufficiently sandboxed or otherwise secured, the user agent SHOULD ensure that users are fully informed and/or give explicit consent before loading or invoking it. Such implementations SHOULD only be supported on secure contexts to mitigate the potential for Network Attacks.

        -
        Note
        +
        Note

        Granting permissions to unauthenticated origins is equivalent to granting the permissions to any origin in the presence of a network attacker. See also User Alerts / Prompts and Use Secure Origin and Transport.

        @@ -5722,7 +5845,7 @@

        User Agents SHOULD ensure that users are fully informed and/or give explicit consent before a Key System that presents security concerns that are greater than other user agent features (e.g. DOM content) may be accessed by an origin. Such alerts and consent SHOULD be per origin to avoid valid uses enabling subsequent malicious access. (A full origin MUST be used rather than just the domain because the protocol is important for security as described above.) User agents SHOULD only persist consent for secure origins (see Secure Origin and Transport), to mitigate the potential for future abuse via Network Attacks.

        -
        Note
        +
        Note

        Granting permissions to unauthenticated origins is equivalent to granting the permissions to any origin in the presence of a network attacker. Alerting or prompting the user for consent on insecure origins without persisting the choice provides at least a minimum level of security because the user would be alerted to unexpected use (e.g. on a site that does not use encrypted media).

        @@ -5758,7 +5881,7 @@

        Using these APIs on shared hosts compromises origin-based security and privacy mitigations implemented by user agents. For example, per-origin Distinctive Identifiers are shared by all authors on one host name, and peristed data may be accessed and manipulated by any author on the host. The latter is especially important if, for example, modification or deletion of such data could erase a user's right to specific content.

        -
        Note
        +
        Note

        Even if a path-restriction feature was made available by user agents, the usual DOM scripting security model would make it trivial to bypass this protection and access the data from any path.

        Authors on shared hosts are therefore RECOMMENDED to avoid using these APIs because doing so compromises origin-based security and privacy mitigations in user agents.

        @@ -5826,7 +5949,7 @@

        -
        Note
        +
        Note

        The type of information covered by this requirement includes but is not limited to:

          @@ -5903,7 +6026,7 @@

          In addition, if a Key System permits keys to be stored and to be re-used between origins, then it may be possible for two origins to collude and track a unique user by recording their ability to access a common key.

          -

          Finally, if any user interface for user control of Key Systems presents data separately from data in HTTP session cookies [COOKIES] or persistent storage, then users are likely to modify site authorization or delete data in one and not the others. This would allow sites to use the various features as redundant backup for each other, defeating a user's attempts to protect his privacy. +

          Finally, if any user interface for user control of Key Systems presents data separately from data in HTTP session cookies [COOKIES] or persistent storage, then users are likely to modify site authorization or delete data in one and not the others. This would allow sites to use the various features as redundant backup for each other, defeating a user's attempts to protect his or her privacy.

          The following section describes techniques that may mitigate the risks of tracking without user consent.

          @@ -5924,10 +6047,10 @@

          -
          Use of (non-reversible) per-origin identifiers
          +
          Use of non-associable per-origin identifiers
          - -

          Implementations that use Distinctive Identifiers MUST use a different value for each origin, either by allocation of different identifiers for different origins or by use of a non-reversible origin-specific mapping from an origin-independent identifier. See Use Per-Origin Identifiers and non-reversible identifiers. + +

          Implementations that use Distinctive Identifiers MUST use a different non-associable value for each origin. See Use Per-Origin Identifiers.

          @@ -5939,7 +6062,7 @@

          Blocking third-party access
          - +

          User agents MAY restrict access to Key Systems and/or features to scripts originating at the origin of the top-level Document of the browsing context. For example, requestMediaKeySystemAccess() may deny requests for certain configurations for pages from other origins running in iframes.

          @@ -5948,7 +6071,7 @@

          User agents MAY, possibly in a manner configured by the user, automatically delete Distinctive Identifiers and/or other Key System data after a period of time.

          -
          Note
          +
          Note

          For example, a user agent could be configured to such data as session-only storage, deleting the data once the user had closed all the browsing contexts that could access it.

          This can restrict the ability of a site to track a user, as the site would then only be able to track the user across multiple sessions when he authenticates with the site itself (e.g. by making a purchase or logging in to a service).

          @@ -5981,13 +6104,13 @@

          User agents MUST prompt or otherwise inform the user before allowing use of a Distinctive Identifier that is not unique per-origin and/or not clearable is used. User agents SHOULD prompt or otherwise inform the user before allowing use of all other Distinctive Identifier.

          -
          Note
          +
          Note

          The "not unique per-origin" and "not clearable" conditions cannot be true in a compliant implementation because implementations MUST use per-origin identifiers and allow the user to clear identifiers.

          Such alerts and consent SHOULD be per origin to avoid valid uses enabling subsequent malicious access. User agent implementers that consider such alerts or consent appropriate for a Key System implementation SHOULD only support such Key Systems on secure origins (see Secure Origin and Transport), especially if they allow such consent to be persisted.

          -
          Note
          +
          Note

          Granting permissions to unauthenticated origins is equivalent to granting the permissions to any origin in the presence of a network attacker.

          @@ -6000,9 +6123,9 @@

          -
          Note
          +
          Note

          While these suggestions prevent trivial use of this API for user tracking, they do not block it altogether. Within a single origin, a site can continue to track the user during a session, and can then pass all this information to a third party along with any identifying information (names, credit card numbers, addresses) obtained by the site. If a third party cooperates with multiple sites to obtain such information, and if identifiers are not - unique per-origin, then a profile can still be created. + unique per-origin, then a profile can still be created.

          @@ -6022,11 +6145,11 @@
          Origin-independent individualization is performed between the CDM and an origin- and application-independent server. The process MUST be performed by the user agent and MUST NOT use these APIs.

          -
          Note
          +
          Note

          For example, such a process may initialize a client device by communicating with a pre-determined server hosted by the user agent or CDM vendor, possibly using identifiers from the client device. Such communication would not involve providing application- or origin-specific information.

          -

          The resulting identifier MUST be origin- and application-independent. Such identifiers MUST NOT be provided to applications (see Use Per-Origin Identifiers), even encrypted. Implementations MAY derive non-reversible per-origin identifiers from such identifiers and provide those to the application (encrypted) +

          The resulting identifier MUST be origin- and application-independent. Such identifiers MUST NOT be provided to applications (see Use Per-Origin Identifiers), even encrypted. Implementations MAY derive non-associable per-origin identifiers from such identifiers and provide those to the application (encrypted).

          For such individualization, all message exchanges:

            @@ -6489,7 +6612,7 @@

            // Evaluate the current state using one of the map-like methods exposed by // event.target.keyStatuses. // For example: - event.target.keyStatuses.forEach(function(keyId, status, map) { + event.target.keyStatuses.forEach(function(status, keyId) { switch (status) { case "usable": break;