This merges the following changes from the Widevine CDM repository: 564f4cc Add CdmClientPropertySet to CDM Adds an interface to the CDM that allows it to query its client for certain properties. In this case, this includes the ability to specify what security level is desired, as well as support for service ceritifcate privacy mode. 9cfbd3e Force Level 3 fallback Adds support for voluntarily invoking L3 crypto to the OEMCrypto wrapper. 95d12c1 Add pointer to CdmClientPropertySet class to OpenSession. Adds support for storing the property set on a session-by-session basis and choosing the appropriate crypto level. 17de442 Add Settable Properties for Clank to Android Adds support for setting the aforementioned properties to the DrmEngine bbe704d Fixes to force fallback to level three security Corrections to invoke provisioning, OEMCrypto API with configured security level rather than the default. Unit tests were also revised. Note that some parts of this are also support for the ability to use a service certificate-based privacy mode. The remaining code for supporting this mode is still forthcoming. Bug: 10109249 Change-Id: I2755e4dea1de3e8a56cff237360298f7b7f1bddc
75 lines
2.2 KiB
C++
75 lines
2.2 KiB
C++
// Copyright 2012 Google Inc. All Rights Reserved.
|
|
|
|
#ifndef CDM_BASE_LICENSE_H_
|
|
#define CDM_BASE_LICENSE_H_
|
|
|
|
#include "wv_cdm_types.h"
|
|
|
|
namespace video_widevine_server {
|
|
namespace sdk {
|
|
class SignedMessage;
|
|
}
|
|
} // namespace video_widevine_server
|
|
|
|
namespace wvcdm {
|
|
|
|
class CryptoSession;
|
|
class PolicyEngine;
|
|
|
|
class CdmLicense {
|
|
public:
|
|
|
|
CdmLicense()
|
|
: session_(NULL),
|
|
initialized_(false),
|
|
service_certificate_response_pending_(false) {};
|
|
~CdmLicense() {};
|
|
|
|
bool Init(const std::string& token, CryptoSession* session,
|
|
PolicyEngine* policy_engine);
|
|
|
|
bool PrepareKeyRequest(const CdmInitData& pssh_data,
|
|
const CdmLicenseType license_type,
|
|
const CdmAppParameterMap& app_parameters,
|
|
const CdmSessionId& session_id,
|
|
CdmKeyMessage* signed_request,
|
|
std::string* server_url);
|
|
bool PrepareKeyUpdateRequest(bool is_renewal, CdmKeyMessage* signed_request,
|
|
std::string* server_url);
|
|
CdmResponseType HandleKeyResponse(const CdmKeyResponse& license_response);
|
|
CdmResponseType HandleKeyUpdateResponse(
|
|
bool is_renewal, const CdmKeyResponse& license_response);
|
|
|
|
bool RestoreOfflineLicense(CdmKeyMessage& license_request,
|
|
CdmKeyResponse& license_response,
|
|
CdmKeyResponse& license_renewal_response);
|
|
bool HasInitData() { return !init_data_.empty(); }
|
|
|
|
private:
|
|
bool PrepareServiceCertificateRequest(CdmKeyMessage* signed_request,
|
|
std::string* server_url);
|
|
CdmResponseType HandleServiceCertificateResponse(
|
|
const CdmKeyResponse& service_certificate_response);
|
|
|
|
CdmResponseType HandleKeyErrorResponse(
|
|
const video_widevine_server::sdk::SignedMessage& signed_message);
|
|
|
|
CryptoSession* session_;
|
|
PolicyEngine* policy_engine_;
|
|
std::string server_url_;
|
|
std::string token_;
|
|
std::string service_certificate_;
|
|
std::string init_data_;
|
|
bool initialized_;
|
|
bool service_certificate_response_pending_;
|
|
|
|
// Used for certificate based licensing
|
|
CdmKeyMessage key_request_;
|
|
|
|
CORE_DISALLOW_COPY_AND_ASSIGN(CdmLicense);
|
|
};
|
|
|
|
} // namespace wvcdm
|
|
|
|
#endif // CDM_BASE_LICENSE_H_
|