OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BASE_DECRYPT_CONFIG_H_ | 5 #ifndef MEDIA_BASE_DECRYPT_CONFIG_H_ |
6 #define MEDIA_BASE_DECRYPT_CONFIG_H_ | 6 #define MEDIA_BASE_DECRYPT_CONFIG_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "media/base/media_export.h" | 10 #include "media/base/media_export.h" |
11 | 11 |
12 namespace media { | 12 namespace media { |
13 | 13 |
14 // Contains all information that a decryptor needs to decrypt. | 14 // Contains all information that a decryptor needs to decrypt a frame. |
15 class MEDIA_EXPORT DecryptConfig { | 15 class MEDIA_EXPORT DecryptConfig { |
16 public: | 16 public: |
17 explicit DecryptConfig(const uint8* key_id, int key_id_size); | 17 // Size in bytes of a 128bit key. |
ddorwin
2012/07/17 00:19:52
Replace with:
// Keys are always 128 bits.
fgalligan1
2012/07/17 16:34:57
Done.
| |
18 static const int kDecryptionKeySize = 16; | |
19 | |
20 // |key_id| is the ID that references the decryption key for this frame. |iv| | |
21 // is the initialization vector defined by the encrypted format. Currently | |
22 // |iv_size| must be 16 bytes as defined by WebM and ISO. |checksum| is the | |
23 // hash value of the encrypted buffer. |checksum| is defined by the | |
24 // encrypted format and may be NULL. |encrypted_frame_offset| is the offset | |
25 // into the encrypted buffer that the encrypted frame starts. The class | |
26 // will copy the data from |key_id|, |iv|, and |checksum|. | |
27 DecryptConfig(const uint8* key_id, int key_id_size, | |
28 const uint8* iv, int iv_size, | |
29 const uint8* checksum, int checksum_size, | |
30 int encrypted_frame_offset); | |
18 ~DecryptConfig(); | 31 ~DecryptConfig(); |
19 | 32 |
20 const uint8* key_id() const { return key_id_.get(); } | 33 const uint8* key_id() const { return key_id_.get(); } |
21 int key_id_size() const { return key_id_size_; } | 34 int key_id_size() const { return key_id_size_; } |
35 const uint8* iv() const { return iv_.get(); } | |
36 int iv_size() const { return iv_size_; } | |
37 const uint8* checksum() const { return checksum_.get(); } | |
38 int checksum_size() const { return checksum_size_; } | |
39 int encrypted_frame_offset() const { return encrypted_frame_offset_; } | |
22 | 40 |
23 private: | 41 private: |
24 scoped_array<uint8> key_id_; | 42 scoped_array<uint8> key_id_; |
25 int key_id_size_; | 43 const int key_id_size_; |
44 | |
45 // Initialization vector. | |
46 scoped_array<uint8> iv_; | |
47 const int iv_size_; | |
48 | |
49 // Checksum of the data to be verified before decrypting the data. This may | |
50 // be NULL for some formats. | |
51 scoped_array<uint8> checksum_; | |
52 const int checksum_size_; | |
53 | |
54 // This is the offset in bytes to where the encrypted data starts within | |
55 // the input buffer. | |
56 const int encrypted_frame_offset_; | |
26 | 57 |
27 DISALLOW_COPY_AND_ASSIGN(DecryptConfig); | 58 DISALLOW_COPY_AND_ASSIGN(DecryptConfig); |
28 }; | 59 }; |
29 | 60 |
30 } // namespace media | 61 } // namespace media |
31 | 62 |
32 #endif // MEDIA_BASE_DECRYPT_CONFIG_H_ | 63 #endif // MEDIA_BASE_DECRYPT_CONFIG_H_ |
OLD | NEW |