| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 // Vector of [key_id, key_value] pairs. Values are raw binary data, stored in | 54 // Vector of [key_id, key_value] pairs. Values are raw binary data, stored in |
| 55 // strings for convenience. | 55 // strings for convenience. |
| 56 typedef std::pair<std::string, std::string> KeyIdAndKeyPair; | 56 typedef std::pair<std::string, std::string> KeyIdAndKeyPair; |
| 57 typedef std::vector<KeyIdAndKeyPair> KeyIdAndKeyPairs; | 57 typedef std::vector<KeyIdAndKeyPair> KeyIdAndKeyPairs; |
| 58 | 58 |
| 59 // Converts a single |key|, |key_id| pair to a JSON Web Key Set. | 59 // Converts a single |key|, |key_id| pair to a JSON Web Key Set. |
| 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 // Converts a set of |key|, |key_id| pairs to a JSON Web Key Set. |
| 64 MEDIA_EXPORT std::string GenerateJWKSet(const KeyIdAndKeyPairs& keys, |
| 65 MediaKeys::SessionType session_type); |
| 66 |
| 63 // Extracts the JSON Web Keys from a JSON Web Key Set. If |input| looks like | 67 // 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 | 68 // a valid JWK Set, then true is returned and |keys| and |session_type| are |
| 65 // updated to contain the values found. Otherwise return false. | 69 // updated to contain the values found. Otherwise return false. |
| 66 MEDIA_EXPORT bool ExtractKeysFromJWKSet(const std::string& jwk_set, | 70 MEDIA_EXPORT bool ExtractKeysFromJWKSet(const std::string& jwk_set, |
| 67 KeyIdAndKeyPairs* keys, | 71 KeyIdAndKeyPairs* keys, |
| 68 MediaKeys::SessionType* session_type); | 72 MediaKeys::SessionType* session_type); |
| 69 | 73 |
| 70 // Extracts the Key Ids from a Key IDs Initialization Data | 74 // Extracts the Key Ids from a Key IDs Initialization Data |
| 71 // (https://w3c.github.io/encrypted-media/keyids-format.html). If |input| looks | 75 // (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 | 76 // valid, then true is returned and |key_ids| is updated to contain the values |
| (...skipping 16 matching lines...) Expand all Loading... |
| 89 // Extract the first key from the license request message. Returns true if | 93 // Extract the first key from the license request message. Returns true if |
| 90 // |license| is a valid license request and contains at least one key, | 94 // |license| is a valid license request and contains at least one key, |
| 91 // otherwise false and |first_key| is not touched. | 95 // otherwise false and |first_key| is not touched. |
| 92 MEDIA_EXPORT bool ExtractFirstKeyIdFromLicenseRequest( | 96 MEDIA_EXPORT bool ExtractFirstKeyIdFromLicenseRequest( |
| 93 const std::vector<uint8>& license, | 97 const std::vector<uint8>& license, |
| 94 std::vector<uint8>* first_key); | 98 std::vector<uint8>* first_key); |
| 95 | 99 |
| 96 } // namespace media | 100 } // namespace media |
| 97 | 101 |
| 98 #endif // MEDIA_CDM_JSON_WEB_KEY_H_ | 102 #endif // MEDIA_CDM_JSON_WEB_KEY_H_ |
| OLD | NEW |