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

Unified Diff: media/cast/transport/utility/transport_encryption_handler.h

Issue 138843011: Cast: Adding helper crypto classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile issues 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/transport/utility/transport_encryption_handler.h
diff --git a/media/cast/transport/utility/transport_encryption_handler.h b/media/cast/transport/utility/transport_encryption_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..db2808467da55981ee8f9706eaf1b19b89b075cb
--- /dev/null
+++ b/media/cast/transport/utility/transport_encryption_handler.h
@@ -0,0 +1,53 @@
+// 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_TRANSPORT_TRANSPORT_UTILITY_ENCRYPTION_HANDLER_H_
+#define MEDIA_CAST_TRANSPORT_TRANSPORT_UTILITY_ENCRYPTION_HANDLER_H_
+
+// Helper class to handle encryption for the Cast Transport 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 {
+namespace transport {
+
+class TransportEncryptionHandler : public base::NonThreadSafe {
+ public:
+ TransportEncryptionHandler();
+ ~TransportEncryptionHandler();
+
+ bool Initialize(std::string aes_key, std::string aes_iv_mask);
+
+ bool Encrypt(uint32 frame_id, std::string data, std::string* encrypted_data);
+
+ bool Decrypt(uint32 frame_id,
+ const base::StringPiece& ciphertext,
+ std::string* plaintext);
+
+ bool initialized() const { return initialized_; }
+
+ private:
+ scoped_ptr<crypto::SymmetricKey> key_;
+ scoped_ptr<crypto::Encryptor> encryptor_;
+ std::string iv_mask_;
+ bool initialized_;
+
+ DISALLOW_COPY_AND_ASSIGN(TransportEncryptionHandler);
+};
+
+} // namespace transport
+} // namespace cast
+} // namespace media
+
+#endif // MEDIA_CAST_TRANSPORT_TRANSPORT_UTILITY_ENCRYPTION_HANDLER_H_
« no previous file with comments | « media/cast/transport/transport_video_sender.cc ('k') | media/cast/transport/utility/transport_encryption_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698