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 #include "media/cdm/aes_decryptor.h" | 5 #include "media/cdm/aes_decryptor.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <list> | 8 #include <list> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 // TODO(jrummell): Convert back to a DCHECK once prefixed EME is removed. | 332 // TODO(jrummell): Convert back to a DCHECK once prefixed EME is removed. |
333 if (valid_sessions_.find(session_id) == valid_sessions_.end()) { | 333 if (valid_sessions_.find(session_id) == valid_sessions_.end()) { |
334 promise->reject(CdmPromise::INVALID_ACCESS_ERROR, 0, | 334 promise->reject(CdmPromise::INVALID_ACCESS_ERROR, 0, |
335 "Session does not exist."); | 335 "Session does not exist."); |
336 return; | 336 return; |
337 } | 337 } |
338 | 338 |
339 std::string key_string(response.begin(), response.end()); | 339 std::string key_string(response.begin(), response.end()); |
340 | 340 |
341 KeyIdAndKeyPairs keys; | 341 KeyIdAndKeyPairs keys; |
342 SessionType session_type = MediaKeys::TEMPORARY_SESSION; | 342 SessionType session_type = ContentDecryptionModule::TEMPORARY_SESSION; |
343 if (!ExtractKeysFromJWKSet(key_string, &keys, &session_type)) { | 343 if (!ExtractKeysFromJWKSet(key_string, &keys, &session_type)) { |
344 promise->reject(CdmPromise::INVALID_ACCESS_ERROR, 0, | 344 promise->reject(CdmPromise::INVALID_ACCESS_ERROR, 0, |
345 "Response is not a valid JSON Web Key Set."); | 345 "Response is not a valid JSON Web Key Set."); |
346 return; | 346 return; |
347 } | 347 } |
348 | 348 |
349 // Make sure that at least one key was extracted. | 349 // Make sure that at least one key was extracted. |
350 if (keys.empty()) { | 350 if (keys.empty()) { |
351 promise->reject(CdmPromise::INVALID_ACCESS_ERROR, 0, | 351 promise->reject(CdmPromise::INVALID_ACCESS_ERROR, 0, |
352 "Response does not contain any keys."); | 352 "Response does not contain any keys."); |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 bool AesDecryptor::DecryptionKey::Init() { | 602 bool AesDecryptor::DecryptionKey::Init() { |
603 CHECK(!secret_.empty()); | 603 CHECK(!secret_.empty()); |
604 decryption_key_ = | 604 decryption_key_ = |
605 crypto::SymmetricKey::Import(crypto::SymmetricKey::AES, secret_); | 605 crypto::SymmetricKey::Import(crypto::SymmetricKey::AES, secret_); |
606 if (!decryption_key_) | 606 if (!decryption_key_) |
607 return false; | 607 return false; |
608 return true; | 608 return true; |
609 } | 609 } |
610 | 610 |
611 } // namespace media | 611 } // namespace media |
OLD | NEW |