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

Side by Side Diff: media/crypto/aes_decryptor.h

Issue 10651006: Add Common Encryption support to BMFF, including subsample decryption. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Convert key_id to string Created 8 years, 5 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 unified diff | Download patch
OLDNEW
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_CRYPTO_AES_DECRYPTOR_H_ 5 #ifndef MEDIA_CRYPTO_AES_DECRYPTOR_H_
6 #define MEDIA_CRYPTO_AES_DECRYPTOR_H_ 6 #define MEDIA_CRYPTO_AES_DECRYPTOR_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 const DecryptCB& decrypt_cb) OVERRIDE; 54 const DecryptCB& decrypt_cb) OVERRIDE;
55 55
56 private: 56 private:
57 // Helper class that manages the decryption key and HMAC key. The HMAC key 57 // Helper class that manages the decryption key and HMAC key. The HMAC key
58 // may be NULL. 58 // may be NULL.
59 class DecryptionKey { 59 class DecryptionKey {
60 public: 60 public:
61 explicit DecryptionKey(const std::string& secret); 61 explicit DecryptionKey(const std::string& secret);
62 ~DecryptionKey(); 62 ~DecryptionKey();
63 63
64 // Creates the encryption key and HMAC. If |derive_webm_keys| is true then 64 // Creates the encryption key, and derives the WebM decryption key and HMAC.
65 // the object will derive the decryption key and the HMAC key from 65 bool Init();
66 // |secret_|.
67 bool Init(bool derive_webm_keys);
68 66
69 crypto::SymmetricKey* decryption_key() { return decryption_key_.get(); } 67 crypto::SymmetricKey* decryption_key() { return decryption_key_.get(); }
68 crypto::SymmetricKey* webm_decryption_key()
ddorwin 2012/07/24 01:00:10 This should be the same as the above value. IOW, n
strobe_ 2012/07/25 01:05:13 OK, anything needed here?
69 { return webm_decryption_key_.get(); }
70 base::StringPiece hmac_key() { return base::StringPiece(hmac_key_); } 70 base::StringPiece hmac_key() { return base::StringPiece(hmac_key_); }
71 71
72 private: 72 private:
73 // The base secret that is used to derive the decryption key and optionally 73 // The base secret that is used to derive the decryption key and optionally
74 // the HMAC key. 74 // the HMAC key.
75 const std::string secret_; 75 const std::string secret_;
76 76
77 // The key used to decrypt the data. 77 // The key used to decrypt the data.
78 scoped_ptr<crypto::SymmetricKey> decryption_key_; 78 scoped_ptr<crypto::SymmetricKey> decryption_key_;
79 79
80 // The key used for decryption of WebM media, derived from the secret.
81 scoped_ptr<crypto::SymmetricKey> webm_decryption_key_;
82
80 // The key used to perform the integrity check. Currently the HMAC key is 83 // The key used to perform the integrity check. Currently the HMAC key is
81 // defined by the WebM encrypted specification. Current encrypted WebM 84 // defined by the WebM encrypted specification. Current encrypted WebM
82 // request for comments specification is here 85 // request for comments specification is here
83 // http://wiki.webmproject.org/encryption/webm-encryption-rfc 86 // http://wiki.webmproject.org/encryption/webm-encryption-rfc
84 std::string hmac_key_; 87 std::string hmac_key_;
85 88
86 DISALLOW_COPY_AND_ASSIGN(DecryptionKey); 89 DISALLOW_COPY_AND_ASSIGN(DecryptionKey);
87 }; 90 };
88 91
89 // KeyMap owns the DecryptionKey* and must delete them when they are 92 // KeyMap owns the DecryptionKey* and must delete them when they are
(...skipping 12 matching lines...) Expand all
102 static uint32 next_session_id_; 105 static uint32 next_session_id_;
103 106
104 DecryptorClient* const client_; 107 DecryptorClient* const client_;
105 108
106 DISALLOW_COPY_AND_ASSIGN(AesDecryptor); 109 DISALLOW_COPY_AND_ASSIGN(AesDecryptor);
107 }; 110 };
108 111
109 } // namespace media 112 } // namespace media
110 113
111 #endif // MEDIA_CRYPTO_AES_DECRYPTOR_H_ 114 #endif // MEDIA_CRYPTO_AES_DECRYPTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698