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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 | 127 |
128 AesDecryptor::AesDecryptor(DecryptorClient* client) | 128 AesDecryptor::AesDecryptor(DecryptorClient* client) |
129 : client_(client) { | 129 : client_(client) { |
130 } | 130 } |
131 | 131 |
132 AesDecryptor::~AesDecryptor() { | 132 AesDecryptor::~AesDecryptor() { |
133 STLDeleteValues(&key_map_); | 133 STLDeleteValues(&key_map_); |
134 } | 134 } |
135 | 135 |
136 bool AesDecryptor::GenerateKeyRequest(const std::string& key_system, | 136 bool AesDecryptor::GenerateKeyRequest(const std::string& key_system, |
137 const std::string& type, | |
ddorwin
2012/10/27 00:08:26
Comment somewhere that ClearKey/AesDecryptor does
xhwang
2012/10/27 00:50:14
Done.
| |
137 const uint8* init_data, | 138 const uint8* init_data, |
138 int init_data_length) { | 139 int init_data_length) { |
139 std::string session_id_string(base::UintToString(next_session_id_++)); | 140 std::string session_id_string(base::UintToString(next_session_id_++)); |
140 | 141 |
141 // For now, just fire the event with the |init_data| as the request. | 142 // For now, just fire the event with the |init_data| as the request. |
142 int message_length = init_data_length; | 143 int message_length = init_data_length; |
143 scoped_array<uint8> message(new uint8[message_length]); | 144 scoped_array<uint8> message(new uint8[message_length]); |
144 memcpy(message.get(), init_data, message_length); | 145 memcpy(message.get(), init_data, message_length); |
145 | 146 |
146 client_->KeyMessage(key_system, session_id_string, | 147 client_->KeyMessage(key_system, session_id_string, |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
301 bool AesDecryptor::DecryptionKey::Init() { | 302 bool AesDecryptor::DecryptionKey::Init() { |
302 CHECK(!secret_.empty()); | 303 CHECK(!secret_.empty()); |
303 decryption_key_.reset(crypto::SymmetricKey::Import( | 304 decryption_key_.reset(crypto::SymmetricKey::Import( |
304 crypto::SymmetricKey::AES, secret_)); | 305 crypto::SymmetricKey::AES, secret_)); |
305 if (!decryption_key_.get()) | 306 if (!decryption_key_.get()) |
306 return false; | 307 return false; |
307 return true; | 308 return true; |
308 } | 309 } |
309 | 310 |
310 } // namespace media | 311 } // namespace media |
OLD | NEW |