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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 } else { | 246 } else { |
247 const std::string& key_id = encrypted->GetDecryptConfig()->key_id(); | 247 const std::string& key_id = encrypted->GetDecryptConfig()->key_id(); |
248 DecryptionKey* key = GetKey(key_id); | 248 DecryptionKey* key = GetKey(key_id); |
249 if (!key) { | 249 if (!key) { |
250 DVLOG(1) << "Could not find a matching key for the given key ID."; | 250 DVLOG(1) << "Could not find a matching key for the given key ID."; |
251 decrypt_cb.Run(kNoKey, NULL); | 251 decrypt_cb.Run(kNoKey, NULL); |
252 return; | 252 return; |
253 } | 253 } |
254 | 254 |
255 crypto::SymmetricKey* decryption_key = key->decryption_key(); | 255 crypto::SymmetricKey* decryption_key = key->decryption_key(); |
256 decrypted = DecryptData(*encrypted, decryption_key); | 256 decrypted = DecryptData(*encrypted.get(), decryption_key); |
257 if (!decrypted) { | 257 if (!decrypted.get()) { |
258 DVLOG(1) << "Decryption failed."; | 258 DVLOG(1) << "Decryption failed."; |
259 decrypt_cb.Run(kError, NULL); | 259 decrypt_cb.Run(kError, NULL); |
260 return; | 260 return; |
261 } | 261 } |
262 } | 262 } |
263 | 263 |
264 decrypted->SetTimestamp(encrypted->GetTimestamp()); | 264 decrypted->SetTimestamp(encrypted->GetTimestamp()); |
265 decrypted->SetDuration(encrypted->GetDuration()); | 265 decrypted->SetDuration(encrypted->GetDuration()); |
266 decrypt_cb.Run(kSuccess, decrypted); | 266 decrypt_cb.Run(kSuccess, decrypted); |
267 } | 267 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 bool AesDecryptor::DecryptionKey::Init() { | 332 bool AesDecryptor::DecryptionKey::Init() { |
333 CHECK(!secret_.empty()); | 333 CHECK(!secret_.empty()); |
334 decryption_key_.reset(crypto::SymmetricKey::Import( | 334 decryption_key_.reset(crypto::SymmetricKey::Import( |
335 crypto::SymmetricKey::AES, secret_)); | 335 crypto::SymmetricKey::AES, secret_)); |
336 if (!decryption_key_) | 336 if (!decryption_key_) |
337 return false; | 337 return false; |
338 return true; | 338 return true; |
339 } | 339 } |
340 | 340 |
341 } // namespace media | 341 } // namespace media |
OLD | NEW |