Add initial support for key rotation through ce cdm interface.

Merge from Widevine repo of http://go/wvgerrit/42941

Bug: 72168544
Test: tested as part of http://go/ag/4674759
Change-Id: I1a2d0f49371e5b3edf1d9dff85b85593f981d1f5
This commit is contained in:
Fred Gylys-Colwell
2018-07-01 17:56:23 -07:00
parent d17199fb83
commit fc4186e4fd
12 changed files with 480 additions and 332 deletions

View File

@@ -27,6 +27,10 @@ class PolicyEngine;
class CdmSession;
class CryptoKey;
using ::google::protobuf::RepeatedPtrField;
using video_widevine::License_KeyContainer;
using video_widevine::WidevinePsshData_EntitledKey;
class CdmLicense {
public:
CdmLicense(const CdmSessionId& session_id);
@@ -50,7 +54,8 @@ class CdmLicense {
const CdmKeyResponse& license_response);
virtual CdmResponseType HandleKeyUpdateResponse(
bool is_renewal, const CdmKeyResponse& license_response);
virtual CdmResponseType HandleSubLicense(const InitializationData& init_data);
virtual CdmResponseType HandleEmbeddedKeyData(
const InitializationData& init_data);
virtual bool RestoreOfflineLicense(
const CdmKeyMessage& license_request,
@@ -101,6 +106,10 @@ class CdmLicense {
const std::vector<CryptoKey>& key_array,
const video_widevine::License& license);
CdmResponseType HandleNewEntitledKeys(
const std::vector<WidevinePsshData_EntitledKey>& wrapped_keys);
CdmResponseType HandleSubLicense(const InitializationData& init_data);
template <typename T>
bool SetTypeAndId(CdmLicenseType license_type, const std::string& request_id,
T* content_id);
@@ -132,16 +141,19 @@ class CdmLicense {
// CdmLicense takes ownership of the clock.
CdmLicense(const CdmSessionId& session_id, Clock* clock);
// For sublicense key embedding. This key array will be initilized with any
// sub session keys we may have received in a license response. These keys
// may be used to support key rotation.
std::vector<CryptoKey> sub_session_key_array_;
// For entitlement key licensing. This holds the keys from the init_data.
// These keys are extracted from the pssh when we generate a license request.
// It is used to load content keys after we have received a license and
// entitelement keys. It is also used in updating the key status info.
std::vector<video_widevine::WrappedKey> wrapped_keys_;
std::vector<WidevinePsshData_EntitledKey> wrapped_keys_;
// For sublicense key embedding. This key array will be initialized with any
// sub session keys we may have received in a license response. These keys
// may be used to support key rotation.
std::vector<CryptoKey> entitlement_key_array_;
CdmLicenseKeyType license_key_type_;
RepeatedPtrField<License_KeyContainer> entitlement_keys_;
#if defined(UNIT_TEST)
friend class CdmLicenseTest;
#endif