Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: media/cdm/aes_decryptor.cc

Issue 975983002: Update Clear Key to support keyids formatted init_data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: escape non-ASCII Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | media/cdm/aes_decryptor_unittest.cc » ('j') | media/cdm/json_web_key.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "media/cdm/aes_decryptor.h" 5 #include "media/cdm/aes_decryptor.h"
6 6
7 #include <list> 7 #include <list>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 if (init_data_type == "webm") { 266 if (init_data_type == "webm") {
267 // |init_data| is simply the key needed. 267 // |init_data| is simply the key needed.
268 keys.push_back( 268 keys.push_back(
269 std::vector<uint8>(init_data, init_data + init_data_length)); 269 std::vector<uint8>(init_data, init_data + init_data_length));
270 } else if (init_data_type == "cenc") { 270 } else if (init_data_type == "cenc") {
271 // |init_data| is a set of 0 or more concatenated 'pssh' boxes. 271 // |init_data| is a set of 0 or more concatenated 'pssh' boxes.
272 if (!GetKeyIdsForCommonSystemId(init_data, init_data_length, &keys)) { 272 if (!GetKeyIdsForCommonSystemId(init_data, init_data_length, &keys)) {
273 promise->reject(NOT_SUPPORTED_ERROR, 0, "No supported PSSH box found."); 273 promise->reject(NOT_SUPPORTED_ERROR, 0, "No supported PSSH box found.");
274 return; 274 return;
275 } 275 }
276 } else if (init_data_type == "keyids") {
277 std::string init_data_string(init_data, init_data + init_data_length);
278 std::string error_message;
279 if (!ExtractKeyIdsFromKeyIdsInitData(init_data_string, &keys,
280 &error_message)) {
281 promise->reject(NOT_SUPPORTED_ERROR, 0, error_message);
282 return;
283 }
276 } else { 284 } else {
277 // TODO(jrummell): Support init_data_type == "keyids".
278 promise->reject(NOT_SUPPORTED_ERROR, 0, "init_data_type not supported."); 285 promise->reject(NOT_SUPPORTED_ERROR, 0, "init_data_type not supported.");
279 return; 286 return;
280 } 287 }
281 CreateLicenseRequest(keys, session_type, &message); 288 CreateLicenseRequest(keys, session_type, &message);
282 } 289 }
283 290
284 promise->resolve(session_id); 291 promise->resolve(session_id);
285 292
286 // No URL needed for license requests. 293 // No URL needed for license requests.
287 session_message_cb_.Run(session_id, LICENSE_REQUEST, message, 294 session_message_cb_.Run(session_id, LICENSE_REQUEST, message,
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 bool AesDecryptor::DecryptionKey::Init() { 576 bool AesDecryptor::DecryptionKey::Init() {
570 CHECK(!secret_.empty()); 577 CHECK(!secret_.empty());
571 decryption_key_.reset(crypto::SymmetricKey::Import( 578 decryption_key_.reset(crypto::SymmetricKey::Import(
572 crypto::SymmetricKey::AES, secret_)); 579 crypto::SymmetricKey::AES, secret_));
573 if (!decryption_key_) 580 if (!decryption_key_)
574 return false; 581 return false;
575 return true; 582 return true;
576 } 583 }
577 584
578 } // namespace media 585 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/cdm/aes_decryptor_unittest.cc » ('j') | media/cdm/json_web_key.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698