| 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 #ifndef MEDIA_CRYPTO_AES_DECRYPTOR_H_ | 5 #ifndef MEDIA_CRYPTO_AES_DECRYPTOR_H_ |
| 6 #define MEDIA_CRYPTO_AES_DECRYPTOR_H_ | 6 #define MEDIA_CRYPTO_AES_DECRYPTOR_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 namespace media { | 24 namespace media { |
| 25 | 25 |
| 26 // Decrypts an AES encrypted buffer into an unencrypted buffer. The AES | 26 // Decrypts an AES encrypted buffer into an unencrypted buffer. The AES |
| 27 // encryption must be CTR with a key size of 128bits. | 27 // encryption must be CTR with a key size of 128bits. |
| 28 class MEDIA_EXPORT AesDecryptor : public MediaKeys, public Decryptor { | 28 class MEDIA_EXPORT AesDecryptor : public MediaKeys, public Decryptor { |
| 29 public: | 29 public: |
| 30 AesDecryptor(const SessionMessageCB& session_message_cb, | 30 AesDecryptor(const SessionMessageCB& session_message_cb, |
| 31 const SessionClosedCB& session_closed_cb, | 31 const SessionClosedCB& session_closed_cb, |
| 32 const SessionKeysChangeCB& session_keys_change_cb); | 32 const SessionKeysChangeCB& session_keys_change_cb); |
| 33 virtual ~AesDecryptor(); | 33 ~AesDecryptor() override; |
| 34 | 34 |
| 35 // MediaKeys implementation. | 35 // MediaKeys implementation. |
| 36 virtual void SetServerCertificate( | 36 void SetServerCertificate(const uint8* certificate_data, |
| 37 const uint8* certificate_data, | 37 int certificate_data_length, |
| 38 int certificate_data_length, | |
| 39 scoped_ptr<SimpleCdmPromise> promise) override; | |
| 40 virtual void CreateSession(const std::string& init_data_type, | |
| 41 const uint8* init_data, | |
| 42 int init_data_length, | |
| 43 SessionType session_type, | |
| 44 scoped_ptr<NewSessionCdmPromise> promise) override; | |
| 45 virtual void LoadSession(const std::string& web_session_id, | |
| 46 scoped_ptr<NewSessionCdmPromise> promise) override; | |
| 47 virtual void UpdateSession(const std::string& web_session_id, | |
| 48 const uint8* response, | |
| 49 int response_length, | |
| 50 scoped_ptr<SimpleCdmPromise> promise) override; | |
| 51 virtual void CloseSession(const std::string& web_session_id, | |
| 52 scoped_ptr<SimpleCdmPromise> promise) override; | 38 scoped_ptr<SimpleCdmPromise> promise) override; |
| 53 virtual void RemoveSession(const std::string& web_session_id, | 39 void CreateSession(const std::string& init_data_type, |
| 54 scoped_ptr<SimpleCdmPromise> promise) override; | 40 const uint8* init_data, |
| 55 virtual void GetUsableKeyIds(const std::string& web_session_id, | 41 int init_data_length, |
| 56 scoped_ptr<KeyIdsPromise> promise) override; | 42 SessionType session_type, |
| 57 virtual Decryptor* GetDecryptor() override; | 43 scoped_ptr<NewSessionCdmPromise> promise) override; |
| 44 void LoadSession(const std::string& web_session_id, |
| 45 scoped_ptr<NewSessionCdmPromise> promise) override; |
| 46 void UpdateSession(const std::string& web_session_id, |
| 47 const uint8* response, |
| 48 int response_length, |
| 49 scoped_ptr<SimpleCdmPromise> promise) override; |
| 50 void CloseSession(const std::string& web_session_id, |
| 51 scoped_ptr<SimpleCdmPromise> promise) override; |
| 52 void RemoveSession(const std::string& web_session_id, |
| 53 scoped_ptr<SimpleCdmPromise> promise) override; |
| 54 void GetUsableKeyIds(const std::string& web_session_id, |
| 55 scoped_ptr<KeyIdsPromise> promise) override; |
| 56 Decryptor* GetDecryptor() override; |
| 58 #if defined(ENABLE_BROWSER_CDMS) | 57 #if defined(ENABLE_BROWSER_CDMS) |
| 59 virtual int GetCdmId() const override; | 58 virtual int GetCdmId() const override; |
| 60 #endif // defined(ENABLE_BROWSER_CDMS) | 59 #endif // defined(ENABLE_BROWSER_CDMS) |
| 61 | 60 |
| 62 // Decryptor implementation. | 61 // Decryptor implementation. |
| 63 virtual void RegisterNewKeyCB(StreamType stream_type, | 62 void RegisterNewKeyCB(StreamType stream_type, |
| 64 const NewKeyCB& key_added_cb) override; | 63 const NewKeyCB& key_added_cb) override; |
| 65 virtual void Decrypt(StreamType stream_type, | 64 void Decrypt(StreamType stream_type, |
| 66 const scoped_refptr<DecoderBuffer>& encrypted, | 65 const scoped_refptr<DecoderBuffer>& encrypted, |
| 67 const DecryptCB& decrypt_cb) override; | 66 const DecryptCB& decrypt_cb) override; |
| 68 virtual void CancelDecrypt(StreamType stream_type) override; | 67 void CancelDecrypt(StreamType stream_type) override; |
| 69 virtual void InitializeAudioDecoder(const AudioDecoderConfig& config, | 68 void InitializeAudioDecoder(const AudioDecoderConfig& config, |
| 70 const DecoderInitCB& init_cb) override; | 69 const DecoderInitCB& init_cb) override; |
| 71 virtual void InitializeVideoDecoder(const VideoDecoderConfig& config, | 70 void InitializeVideoDecoder(const VideoDecoderConfig& config, |
| 72 const DecoderInitCB& init_cb) override; | 71 const DecoderInitCB& init_cb) override; |
| 73 virtual void DecryptAndDecodeAudio( | 72 void DecryptAndDecodeAudio(const scoped_refptr<DecoderBuffer>& encrypted, |
| 74 const scoped_refptr<DecoderBuffer>& encrypted, | 73 const AudioDecodeCB& audio_decode_cb) override; |
| 75 const AudioDecodeCB& audio_decode_cb) override; | 74 void DecryptAndDecodeVideo(const scoped_refptr<DecoderBuffer>& encrypted, |
| 76 virtual void DecryptAndDecodeVideo( | 75 const VideoDecodeCB& video_decode_cb) override; |
| 77 const scoped_refptr<DecoderBuffer>& encrypted, | 76 void ResetDecoder(StreamType stream_type) override; |
| 78 const VideoDecodeCB& video_decode_cb) override; | 77 void DeinitializeDecoder(StreamType stream_type) override; |
| 79 virtual void ResetDecoder(StreamType stream_type) override; | |
| 80 virtual void DeinitializeDecoder(StreamType stream_type) override; | |
| 81 | 78 |
| 82 private: | 79 private: |
| 83 // TODO(fgalligan): Remove this and change KeyMap to use crypto::SymmetricKey | 80 // TODO(fgalligan): Remove this and change KeyMap to use crypto::SymmetricKey |
| 84 // as there are no decryptors that are performing an integrity check. | 81 // as there are no decryptors that are performing an integrity check. |
| 85 // Helper class that manages the decryption key. | 82 // Helper class that manages the decryption key. |
| 86 class DecryptionKey { | 83 class DecryptionKey { |
| 87 public: | 84 public: |
| 88 explicit DecryptionKey(const std::string& secret); | 85 explicit DecryptionKey(const std::string& secret); |
| 89 ~DecryptionKey(); | 86 ~DecryptionKey(); |
| 90 | 87 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // Protect |new_audio_key_cb_| and |new_video_key_cb_| as they are set on the | 147 // Protect |new_audio_key_cb_| and |new_video_key_cb_| as they are set on the |
| 151 // main thread but called on the media thread. | 148 // main thread but called on the media thread. |
| 152 mutable base::Lock new_key_cb_lock_; | 149 mutable base::Lock new_key_cb_lock_; |
| 153 | 150 |
| 154 DISALLOW_COPY_AND_ASSIGN(AesDecryptor); | 151 DISALLOW_COPY_AND_ASSIGN(AesDecryptor); |
| 155 }; | 152 }; |
| 156 | 153 |
| 157 } // namespace media | 154 } // namespace media |
| 158 | 155 |
| 159 #endif // MEDIA_CRYPTO_AES_DECRYPTOR_H_ | 156 #endif // MEDIA_CRYPTO_AES_DECRYPTOR_H_ |
| OLD | NEW |