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. |
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 // The sizes are from the WebM encrypted specification. Current WebM |
| 18 // encrypted request for comments specification is here |
| 19 // http://wiki.webmproject.org/encryption/webm-encryption-rfc. |
| 20 static const int kIvSize = 8; |
| 21 static const int kKeySize = 16; |
| 22 static const int kWebMIntegrityCheckSize = 12; |
| 23 |
| 24 DecryptConfig(const uint8* hmac, int hmac_size, |
| 25 uint64 iv, |
| 26 const uint8* key_id, int key_id_size); |
18 ~DecryptConfig(); | 27 ~DecryptConfig(); |
19 | 28 |
| 29 const uint8* hmac() const { return hmac_.get(); } |
| 30 int hmac_size() const { return hmac_size_; } |
| 31 uint64 iv() const { return iv_; } |
20 const uint8* key_id() const { return key_id_.get(); } | 32 const uint8* key_id() const { return key_id_.get(); } |
21 int key_id_size() const { return key_id_size_; } | 33 int key_id_size() const { return key_id_size_; } |
22 | 34 |
23 private: | 35 private: |
| 36 // HMAC defined from the WebM specification. |
| 37 scoped_array<uint8> hmac_; |
| 38 int hmac_size_; |
| 39 |
| 40 // Initialization vector defined from the WebM specification. |
| 41 uint64 iv_; |
| 42 |
24 scoped_array<uint8> key_id_; | 43 scoped_array<uint8> key_id_; |
25 int key_id_size_; | 44 int key_id_size_; |
26 | 45 |
27 DISALLOW_COPY_AND_ASSIGN(DecryptConfig); | 46 DISALLOW_COPY_AND_ASSIGN(DecryptConfig); |
28 }; | 47 }; |
29 | 48 |
30 } // namespace media | 49 } // namespace media |
31 | 50 |
32 #endif // MEDIA_BASE_DECRYPT_CONFIG_H_ | 51 #endif // MEDIA_BASE_DECRYPT_CONFIG_H_ |
OLD | NEW |