Index: media/cast/utility/cast_decryption_handler.h |
diff --git a/media/cast/utility/cast_decryption_handler.h b/media/cast/utility/cast_decryption_handler.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c0e344afc98814eea74d50edbab3075d65ca4c19 |
--- /dev/null |
+++ b/media/cast/utility/cast_decryption_handler.h |
@@ -0,0 +1,49 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef MEDIA_CAST_UTILITY_CAST_DECRYPTION_HANDLER_H_ |
+#define MEDIA_CAST_UTILITY_CAST_DECRYPTION_HANDLER_H_ |
+ |
+// Helper class to handle decryption for the Cast library. |
+#include <string> |
+ |
+#include "base/basictypes.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "base/strings/string_piece.h" |
+#include "base/threading/non_thread_safe.h" |
+ |
+namespace crypto { |
+class Encryptor; |
+class SymmetricKey; |
+} |
+ |
+namespace media { |
+namespace cast { |
+ |
+class CastDecryptionHandler : public base::NonThreadSafe { |
+ public: |
+ CastDecryptionHandler(); |
+ ~CastDecryptionHandler(); |
+ |
+ bool Initialize(std::string aes_key, std::string aes_iv_mask); |
+ |
+ bool Decrypt(uint32 frame_id, |
+ const base::StringPiece& ciphertext, |
+ std::string* plaintext); |
+ |
+ bool initialized() const { return initialized_; } |
+ |
+ private: |
+ scoped_ptr<crypto::SymmetricKey> key_; |
+ std::string iv_mask_; |
+ scoped_ptr<crypto::Encryptor> decryptor_; |
+ bool initialized_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(CastDecryptionHandler); |
+}; |
+ |
+} // namespace cast |
+} // namespace media |
+ |
+#endif // MEDIA_CAST_UTILITY_CAST_DECRYPTION_HANDLER_H_ |