Chromium Code Reviews| Index: media/cdm/json_web_key.h |
| diff --git a/media/cdm/json_web_key.h b/media/cdm/json_web_key.h |
| index cb483aeb8bd0af2d6d2e6c119ab63bad40e2af47..41e318466a5b87141a7b2512621a55ae3474281e 100644 |
| --- a/media/cdm/json_web_key.h |
| +++ b/media/cdm/json_web_key.h |
| @@ -11,21 +11,41 @@ |
| #include "base/basictypes.h" |
| #include "media/base/media_export.h" |
| +#include "media/base/media_keys.h" |
| namespace media { |
| +// The ClearKey license request format is a JSON object containing the |
| +// following members: |
|
xhwang
2014/07/30 05:56:07
provide ref to the eme spec
jrummell
2014/07/30 18:44:15
Done.
|
| +// "kids" : An array of key IDs. Each element of the array is the base64url |
| +// encoding of the octet sequence containing the key ID value. |
| +// "type" : The requested SessionType. |
| +// An example: |
| +// { "kids":["67ef0gd8pvfd0","77ef0gd8pvfd0"], "type":"temporary" } |
| + |
| +// The ClearKey license format is a JSON Web Key (JWK) Set containing |
| +// representation of the symmetric key to be used for decryption. |
| +// For each JWK in the set, the parameter values are as follows: |
| +// "kty" (key type) : "oct" (octet sequence) |
| +// "alg" (algorithm) : "A128KW" (AES key wrap using a 128-bit key) |
| +// "k" (key value) : The base64url encoding of the octet sequence |
| +// containing the symmetric key value. |
| +// "kid" (key ID) : The base64url encoding of the octet sequence |
| +// containing the key ID value. |
| +// The JSON object may have an optional "type" member value, which may be |
| +// any of the SessionType values. If not specified, the default value of |
| +// "temporary" is used. |
| // A JSON Web Key Set looks like the following in JSON: |
| -// { "keys": [ JWK1, JWK2, ... ] } |
| +// { "keys": [ JWK1, JWK2, ... ], "type":"temporary" } |
| // A symmetric keys JWK looks like the following in JSON: |
| // { "kty":"oct", |
| +// "alg":"A128KW", |
| // "kid":"AQIDBAUGBwgJCgsMDQ4PEA", |
| // "k":"FBUWFxgZGhscHR4fICEiIw" } |
| + |
| // There may be other properties specified, but they are ignored. |
| // Ref: http://tools.ietf.org/html/draft-ietf-jose-json-web-key and: |
| // http://tools.ietf.org/html/draft-jones-jose-json-private-and-symmetric-key |
| -// |
| -// For EME WD, both 'kid' and 'k' are base64 encoded strings, without trailing |
| -// padding. |
| // Vector of [key_id, key_value] pairs. Values are raw binary data, stored in |
| // strings for convenience. |
| @@ -37,10 +57,24 @@ MEDIA_EXPORT std::string GenerateJWKSet(const uint8* key, int key_length, |
| const uint8* key_id, int key_id_length); |
| // Extracts the JSON Web Keys from a JSON Web Key Set. If |input| looks like |
| -// a valid JWK Set, then true is returned and |keys| is updated to contain |
| -// the list of keys found. Otherwise return false. |
| +// a valid JWK Set, then true is returned and |keys| and |session_type| are |
| +// updated to contain the values found. Otherwise return false. |
| MEDIA_EXPORT bool ExtractKeysFromJWKSet(const std::string& jwk_set, |
| - KeyIdAndKeyPairs* keys); |
| + KeyIdAndKeyPairs* keys, |
| + MediaKeys::SessionType* session_type); |
| + |
| +// Create a license request message for the |key_id| and |session_type| |
| +// specified. Currently ClearKey generates a message for each key individually, |
| +// so no need to take a list of |key_id|'s. |result| is updated to contain the |
| +// resulting JSON string. |
| +MEDIA_EXPORT void CreateLicenseRequest(const uint8* key_id, |
| + int key_id_length, |
| + MediaKeys::SessionType session_type, |
| + std::vector<uint8>& result); |
|
xhwang
2014/07/30 05:56:07
We prefer to using pointer for output parameters:
jrummell
2014/07/30 18:44:15
Done.
|
| + |
| +// Extract the first key from the license request message. |
|
xhwang
2014/07/30 05:56:07
From the documentation on l.18-24, a license reque
jrummell
2014/07/30 18:44:15
Done.
|
| +MEDIA_EXPORT bool ExtractLicenseKey(const std::vector<uint8>& message, |
|
xhwang
2014/07/30 05:56:07
what is the return value?
jrummell
2014/07/30 18:44:15
Done.
|
| + std::vector<uint8>& first_key); |
|
xhwang
2014/07/30 05:56:07
ditto about passing pointer instead of ref
jrummell
2014/07/30 18:44:15
Done.
|
| } // namespace media |