OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MEDIA_CAST_TRANSPORT_TRANSPORT_UTILITY_ENCRYPTION_HANDLER_H_ |
| 6 #define MEDIA_CAST_TRANSPORT_TRANSPORT_UTILITY_ENCRYPTION_HANDLER_H_ |
| 7 |
| 8 // Helper class to handle encryption for the Cast Transport library. |
| 9 #include <string> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/strings/string_piece.h" |
| 14 #include "base/threading/non_thread_safe.h" |
| 15 |
| 16 namespace crypto { |
| 17 class Encryptor; |
| 18 class SymmetricKey; |
| 19 } |
| 20 |
| 21 namespace media { |
| 22 namespace cast { |
| 23 namespace transport { |
| 24 |
| 25 class TransportEncryptionHandler : public base::NonThreadSafe { |
| 26 public: |
| 27 TransportEncryptionHandler(); |
| 28 ~TransportEncryptionHandler(); |
| 29 |
| 30 bool Initialize(std::string aes_key, std::string aes_iv_mask); |
| 31 |
| 32 bool Encrypt(uint32 frame_id, std::string data, std::string* encrypted_data); |
| 33 |
| 34 bool Decrypt(uint32 frame_id, |
| 35 const base::StringPiece& ciphertext, |
| 36 std::string* plaintext); |
| 37 |
| 38 bool initialized() const { return initialized_; } |
| 39 |
| 40 private: |
| 41 scoped_ptr<crypto::SymmetricKey> key_; |
| 42 scoped_ptr<crypto::Encryptor> encryptor_; |
| 43 std::string iv_mask_; |
| 44 bool initialized_; |
| 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(TransportEncryptionHandler); |
| 47 }; |
| 48 |
| 49 } // namespace transport |
| 50 } // namespace cast |
| 51 } // namespace media |
| 52 |
| 53 #endif // MEDIA_CAST_TRANSPORT_TRANSPORT_UTILITY_ENCRYPTION_HANDLER_H_ |
OLD | NEW |