OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_CDM_JSON_WEB_KEY_H_ | 5 #ifndef MEDIA_CDM_JSON_WEB_KEY_H_ |
6 #define MEDIA_CDM_JSON_WEB_KEY_H_ | 6 #define MEDIA_CDM_JSON_WEB_KEY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 MEDIA_EXPORT std::string GenerateJWKSet(const uint8* key, int key_length, | 60 MEDIA_EXPORT std::string GenerateJWKSet(const uint8* key, int key_length, |
61 const uint8* key_id, int key_id_length); | 61 const uint8* key_id, int key_id_length); |
62 | 62 |
63 // Extracts the JSON Web Keys from a JSON Web Key Set. If |input| looks like | 63 // Extracts the JSON Web Keys from a JSON Web Key Set. If |input| looks like |
64 // a valid JWK Set, then true is returned and |keys| and |session_type| are | 64 // a valid JWK Set, then true is returned and |keys| and |session_type| are |
65 // updated to contain the values found. Otherwise return false. | 65 // updated to contain the values found. Otherwise return false. |
66 MEDIA_EXPORT bool ExtractKeysFromJWKSet(const std::string& jwk_set, | 66 MEDIA_EXPORT bool ExtractKeysFromJWKSet(const std::string& jwk_set, |
67 KeyIdAndKeyPairs* keys, | 67 KeyIdAndKeyPairs* keys, |
68 MediaKeys::SessionType* session_type); | 68 MediaKeys::SessionType* session_type); |
69 | 69 |
| 70 // Extracts the Key Ids from a Key IDs Initialization Data |
| 71 // (https://w3c.github.io/encrypted-media/keyids-format.html). If |input| looks |
| 72 // valid, then true is returned and |key_ids| is updated to contain the values |
| 73 // found. Otherwise return false and |error_message| contains the reason. |
| 74 MEDIA_EXPORT bool ExtractKeyIdsFromKeyIdsInitData(const std::string& input, |
| 75 KeyIdList* key_ids, |
| 76 std::string* error_message); |
| 77 |
70 // Creates a license request message for the |key_ids| and |session_type| | 78 // Creates a license request message for the |key_ids| and |session_type| |
71 // specified. |license| is updated to contain the resulting JSON string. | 79 // specified. |license| is updated to contain the resulting JSON string. |
72 MEDIA_EXPORT void CreateLicenseRequest(const KeyIdList& key_ids, | 80 MEDIA_EXPORT void CreateLicenseRequest(const KeyIdList& key_ids, |
73 MediaKeys::SessionType session_type, | 81 MediaKeys::SessionType session_type, |
74 std::vector<uint8>* license); | 82 std::vector<uint8>* license); |
75 | 83 |
76 // Extract the first key from the license request message. Returns true if | 84 // Extract the first key from the license request message. Returns true if |
77 // |license| is a valid license request and contains at least one key, | 85 // |license| is a valid license request and contains at least one key, |
78 // otherwise false and |first_key| is not touched. | 86 // otherwise false and |first_key| is not touched. |
79 MEDIA_EXPORT bool ExtractFirstKeyIdFromLicenseRequest( | 87 MEDIA_EXPORT bool ExtractFirstKeyIdFromLicenseRequest( |
80 const std::vector<uint8>& license, | 88 const std::vector<uint8>& license, |
81 std::vector<uint8>* first_key); | 89 std::vector<uint8>* first_key); |
82 | 90 |
83 } // namespace media | 91 } // namespace media |
84 | 92 |
85 #endif // MEDIA_CDM_JSON_WEB_KEY_H_ | 93 #endif // MEDIA_CDM_JSON_WEB_KEY_H_ |
OLD | NEW |