OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/crypto/aes_decryptor.h" | 5 #include "media/crypto/aes_decryptor.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 std::string session_id_string(base::UintToString(next_session_id_++)); | 145 std::string session_id_string(base::UintToString(next_session_id_++)); |
146 | 146 |
147 // For now, the AesDecryptor does not care about |key_system| and |type|; | 147 // For now, the AesDecryptor does not care about |key_system| and |type|; |
148 // just fire the event with the |init_data| as the request. | 148 // just fire the event with the |init_data| as the request. |
149 std::string message; | 149 std::string message; |
150 if (init_data && init_data_length) { | 150 if (init_data && init_data_length) { |
151 message = std::string(reinterpret_cast<const char*>(init_data), | 151 message = std::string(reinterpret_cast<const char*>(init_data), |
152 init_data_length); | 152 init_data_length); |
153 } | 153 } |
154 | 154 |
155 key_message_cb_.Run(key_system, session_id_string, message, ""); | 155 key_message_cb_.Run(key_system, session_id_string, message, std::string()); |
156 return true; | 156 return true; |
157 } | 157 } |
158 | 158 |
159 void AesDecryptor::AddKey(const std::string& key_system, | 159 void AesDecryptor::AddKey(const std::string& key_system, |
160 const uint8* key, | 160 const uint8* key, |
161 int key_length, | 161 int key_length, |
162 const uint8* init_data, | 162 const uint8* init_data, |
163 int init_data_length, | 163 int init_data_length, |
164 const std::string& session_id) { | 164 const std::string& session_id) { |
165 CHECK(key); | 165 CHECK(key); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 bool AesDecryptor::DecryptionKey::Init() { | 328 bool AesDecryptor::DecryptionKey::Init() { |
329 CHECK(!secret_.empty()); | 329 CHECK(!secret_.empty()); |
330 decryption_key_.reset(crypto::SymmetricKey::Import( | 330 decryption_key_.reset(crypto::SymmetricKey::Import( |
331 crypto::SymmetricKey::AES, secret_)); | 331 crypto::SymmetricKey::AES, secret_)); |
332 if (!decryption_key_.get()) | 332 if (!decryption_key_.get()) |
333 return false; | 333 return false; |
334 return true; | 334 return true; |
335 } | 335 } |
336 | 336 |
337 } // namespace media | 337 } // namespace media |
OLD | NEW |