Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(702)

Unified Diff: media/cast/utility/cast_decryption_handler.h

Issue 138843011: Cast: Adding helper crypto classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698