Reformat wv core/include files
[ Merge of http://go/wvgerrit/80483 ] Clang-format has been run on files in core/include Bug: 134365840 Test: WV unit/integration tests Change-Id: I890127f23f30f0e63f826d3638521b4cc12fb995
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
#define WVCDM_CORE_BUFFER_READER_H_
|
#define WVCDM_CORE_BUFFER_READER_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#define WVCDM_CORE_CDM_CLIENT_PROPERTY_SET_H_
|
#define WVCDM_CORE_CDM_CLIENT_PROPERTY_SET_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|||||||
@@ -33,30 +33,31 @@ class UsagePropertySet;
|
|||||||
class WvCdmEventListener;
|
class WvCdmEventListener;
|
||||||
|
|
||||||
// Keep expiration time for each key set
|
// Keep expiration time for each key set
|
||||||
typedef std::map<CdmKeySetId,
|
typedef std::map<CdmKeySetId, std::pair<CdmSessionId, int64_t> >
|
||||||
std::pair<CdmSessionId, int64_t> > CdmReleaseKeySetMap;
|
CdmReleaseKeySetMap;
|
||||||
|
|
||||||
class CdmEngine {
|
class CdmEngine {
|
||||||
public:
|
public:
|
||||||
virtual ~CdmEngine();
|
virtual ~CdmEngine();
|
||||||
|
|
||||||
// Session related methods
|
// Session related methods
|
||||||
virtual CdmResponseType OpenSession(
|
virtual CdmResponseType OpenSession(const CdmKeySystem& key_system,
|
||||||
const CdmKeySystem& key_system, CdmClientPropertySet* property_set,
|
CdmClientPropertySet* property_set,
|
||||||
const CdmSessionId& forced_session_id,
|
const CdmSessionId& forced_session_id,
|
||||||
WvCdmEventListener* event_listener);
|
WvCdmEventListener* event_listener);
|
||||||
|
|
||||||
virtual CdmResponseType OpenSession(
|
virtual CdmResponseType OpenSession(const CdmKeySystem& key_system,
|
||||||
const CdmKeySystem& key_system, CdmClientPropertySet* property_set,
|
CdmClientPropertySet* property_set,
|
||||||
WvCdmEventListener* event_listener, CdmSessionId* session_id);
|
WvCdmEventListener* event_listener,
|
||||||
|
CdmSessionId* session_id);
|
||||||
|
|
||||||
virtual CdmResponseType CloseSession(const CdmSessionId& session_id);
|
virtual CdmResponseType CloseSession(const CdmSessionId& session_id);
|
||||||
|
|
||||||
virtual bool IsOpenSession(const CdmSessionId& session_id);
|
virtual bool IsOpenSession(const CdmSessionId& session_id);
|
||||||
|
|
||||||
virtual CdmResponseType OpenKeySetSession(
|
virtual CdmResponseType OpenKeySetSession(const CdmKeySetId& key_set_id,
|
||||||
const CdmKeySetId& key_set_id, CdmClientPropertySet* property_set,
|
CdmClientPropertySet* property_set,
|
||||||
WvCdmEventListener* event_listener);
|
WvCdmEventListener* event_listener);
|
||||||
|
|
||||||
virtual CdmResponseType CloseKeySetSession(const CdmKeySetId& key_set_id);
|
virtual CdmResponseType CloseKeySetSession(const CdmKeySetId& key_set_id);
|
||||||
|
|
||||||
@@ -129,8 +130,8 @@ class CdmEngine {
|
|||||||
virtual CdmResponseType RemoveLicense(const CdmSessionId& session_id);
|
virtual CdmResponseType RemoveLicense(const CdmSessionId& session_id);
|
||||||
|
|
||||||
// Construct valid renewal request for the current session keys.
|
// Construct valid renewal request for the current session keys.
|
||||||
virtual CdmResponseType GenerateRenewalRequest(
|
virtual CdmResponseType GenerateRenewalRequest(const CdmSessionId& session_id,
|
||||||
const CdmSessionId& session_id, CdmKeyRequest* key_request);
|
CdmKeyRequest* key_request);
|
||||||
|
|
||||||
// Accept renewal response and update key info.
|
// Accept renewal response and update key info.
|
||||||
virtual CdmResponseType RenewKey(const CdmSessionId& session_id,
|
virtual CdmResponseType RenewKey(const CdmSessionId& session_id,
|
||||||
@@ -174,8 +175,8 @@ class CdmEngine {
|
|||||||
// Generate and return a valid provisioning request.
|
// Generate and return a valid provisioning request.
|
||||||
virtual CdmResponseType GetProvisioningRequest(
|
virtual CdmResponseType GetProvisioningRequest(
|
||||||
CdmCertificateType cert_type, const std::string& cert_authority,
|
CdmCertificateType cert_type, const std::string& cert_authority,
|
||||||
const std::string& service_certificate,
|
const std::string& service_certificate, CdmProvisioningRequest* request,
|
||||||
CdmProvisioningRequest* request, std::string* default_url);
|
std::string* default_url);
|
||||||
|
|
||||||
// Verify and process a provisioning response.
|
// Verify and process a provisioning response.
|
||||||
virtual CdmResponseType HandleProvisioningResponse(
|
virtual CdmResponseType HandleProvisioningResponse(
|
||||||
@@ -214,14 +215,12 @@ class CdmEngine {
|
|||||||
|
|
||||||
// Get offline license status: active, release or unknown
|
// Get offline license status: active, release or unknown
|
||||||
virtual CdmResponseType GetOfflineLicenseState(
|
virtual CdmResponseType GetOfflineLicenseState(
|
||||||
const std::string& key_set_id,
|
const std::string& key_set_id, CdmSecurityLevel security_level,
|
||||||
CdmSecurityLevel security_level,
|
|
||||||
CdmOfflineLicenseState* license_state);
|
CdmOfflineLicenseState* license_state);
|
||||||
|
|
||||||
// Remove offline license with the given key_set_id
|
// Remove offline license with the given key_set_id
|
||||||
virtual CdmResponseType RemoveOfflineLicense(
|
virtual CdmResponseType RemoveOfflineLicense(const std::string& key_set_id,
|
||||||
const std::string& key_set_id,
|
CdmSecurityLevel security_level);
|
||||||
CdmSecurityLevel security_level);
|
|
||||||
|
|
||||||
// Usage related methods for streaming licenses
|
// Usage related methods for streaming licenses
|
||||||
// Retrieve a random usage info from the list of all usage infos for this app
|
// Retrieve a random usage info from the list of all usage infos for this app
|
||||||
@@ -249,8 +248,7 @@ class CdmEngine {
|
|||||||
virtual CdmResponseType RemoveAllUsageInfo(const std::string& app_id);
|
virtual CdmResponseType RemoveAllUsageInfo(const std::string& app_id);
|
||||||
|
|
||||||
virtual CdmResponseType RemoveUsageInfo(
|
virtual CdmResponseType RemoveUsageInfo(
|
||||||
const std::string& app_id,
|
const std::string& app_id, const CdmSecureStopId& secure_stop_id);
|
||||||
const CdmSecureStopId& secure_stop_id);
|
|
||||||
|
|
||||||
virtual CdmResponseType ReleaseUsageInfo(
|
virtual CdmResponseType ReleaseUsageInfo(
|
||||||
const CdmUsageInfoReleaseMessage& message);
|
const CdmUsageInfoReleaseMessage& message);
|
||||||
@@ -266,16 +264,20 @@ class CdmEngine {
|
|||||||
// application can use outside of content stream processing
|
// application can use outside of content stream processing
|
||||||
|
|
||||||
// Encrypts a buffer of app-level data.
|
// Encrypts a buffer of app-level data.
|
||||||
virtual CdmResponseType GenericEncrypt(
|
virtual CdmResponseType GenericEncrypt(const std::string& session_id,
|
||||||
const std::string& session_id, const std::string& in_buffer,
|
const std::string& in_buffer,
|
||||||
const std::string& key_id, const std::string& iv,
|
const std::string& key_id,
|
||||||
CdmEncryptionAlgorithm algorithm, std::string* out_buffer);
|
const std::string& iv,
|
||||||
|
CdmEncryptionAlgorithm algorithm,
|
||||||
|
std::string* out_buffer);
|
||||||
|
|
||||||
// Decrypts a buffer of app-level data.
|
// Decrypts a buffer of app-level data.
|
||||||
virtual CdmResponseType GenericDecrypt(
|
virtual CdmResponseType GenericDecrypt(const std::string& session_id,
|
||||||
const std::string& session_id, const std::string& in_buffer,
|
const std::string& in_buffer,
|
||||||
const std::string& key_id, const std::string& iv,
|
const std::string& key_id,
|
||||||
CdmEncryptionAlgorithm algorithm, std::string* out_buffer);
|
const std::string& iv,
|
||||||
|
CdmEncryptionAlgorithm algorithm,
|
||||||
|
std::string* out_buffer);
|
||||||
|
|
||||||
// Computes the signature for a message.
|
// Computes the signature for a message.
|
||||||
virtual CdmResponseType GenericSign(const std::string& session_id,
|
virtual CdmResponseType GenericSign(const std::string& session_id,
|
||||||
@@ -336,9 +338,7 @@ class CdmEngine {
|
|||||||
virtual void SetAppPackageName(const std::string& app_package_name) {
|
virtual void SetAppPackageName(const std::string& app_package_name) {
|
||||||
app_package_name_ = app_package_name;
|
app_package_name_ = app_package_name;
|
||||||
}
|
}
|
||||||
virtual const std::string& GetAppPackageName() {
|
virtual const std::string& GetAppPackageName() { return app_package_name_; }
|
||||||
return app_package_name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class CdmEngineFactory;
|
friend class CdmEngineFactory;
|
||||||
@@ -354,17 +354,17 @@ class CdmEngine {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// private methods
|
// private methods
|
||||||
CdmResponseType OpenSession(
|
CdmResponseType OpenSession(const CdmKeySystem& key_system,
|
||||||
const CdmKeySystem& key_system, CdmClientPropertySet* property_set,
|
CdmClientPropertySet* property_set,
|
||||||
WvCdmEventListener* event_listener, const CdmSessionId* forced_session_id,
|
WvCdmEventListener* event_listener,
|
||||||
CdmSessionId* session_id);
|
const CdmSessionId* forced_session_id,
|
||||||
|
CdmSessionId* session_id);
|
||||||
|
|
||||||
void DeleteAllUsageReportsUponFactoryReset();
|
void DeleteAllUsageReportsUponFactoryReset();
|
||||||
bool ValidateKeySystem(const CdmKeySystem& key_system);
|
bool ValidateKeySystem(const CdmKeySystem& key_system);
|
||||||
CdmResponseType GetUsageInfo(const std::string& app_id,
|
CdmResponseType GetUsageInfo(const std::string& app_id,
|
||||||
SecurityLevel requested_security_level,
|
SecurityLevel requested_security_level,
|
||||||
int* error_detail,
|
int* error_detail, CdmUsageInfo* usage_info);
|
||||||
CdmUsageInfo* usage_info);
|
|
||||||
|
|
||||||
void OnKeyReleaseEvent(const CdmKeySetId& key_set_id);
|
void OnKeyReleaseEvent(const CdmKeySetId& key_set_id);
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class WvCdmEventListener;
|
|||||||
// FileSystem* file_system; // Construction of FileSystem object not shown.
|
// FileSystem* file_system; // Construction of FileSystem object not shown.
|
||||||
// std::shared_ptr<metrics::EngineMetrics> metrics(new EngineMetrics);
|
// std::shared_ptr<metrics::EngineMetrics> metrics(new EngineMetrics);
|
||||||
// CdmEngine* e = new CdmEngineMetricsImpl<CdmEngine>(file_system, metrics);
|
// CdmEngine* e = new CdmEngineMetricsImpl<CdmEngine>(file_system, metrics);
|
||||||
template<class T>
|
template <class T>
|
||||||
class CdmEngineMetricsImpl : public T {
|
class CdmEngineMetricsImpl : public T {
|
||||||
public:
|
public:
|
||||||
// This constructor initializes the instance and takes ownership of |metrics|.
|
// This constructor initializes the instance and takes ownership of |metrics|.
|
||||||
@@ -52,37 +52,37 @@ class CdmEngineMetricsImpl : public T {
|
|||||||
: T(file_system, metrics, spoid), metrics_(metrics) {
|
: T(file_system, metrics, spoid), metrics_(metrics) {
|
||||||
metrics_->cdm_engine_creation_time_millis_.Record(clock_.GetCurrentTime());
|
metrics_->cdm_engine_creation_time_millis_.Record(clock_.GetCurrentTime());
|
||||||
std::string cdm_version;
|
std::string cdm_version;
|
||||||
if(Properties::GetWVCdmVersion(&cdm_version)) {
|
if (Properties::GetWVCdmVersion(&cdm_version)) {
|
||||||
metrics_->cdm_engine_cdm_version_.Record(cdm_version);
|
metrics_->cdm_engine_cdm_version_.Record(cdm_version);
|
||||||
} else {
|
} else {
|
||||||
metrics_->cdm_engine_cdm_version_.SetError(false);
|
metrics_->cdm_engine_cdm_version_.SetError(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~CdmEngineMetricsImpl() override {};
|
~CdmEngineMetricsImpl() override{};
|
||||||
|
|
||||||
bool GetMetricsSnapshot(drm_metrics::WvCdmMetrics *metrics) override {
|
bool GetMetricsSnapshot(drm_metrics::WvCdmMetrics* metrics) override {
|
||||||
if (metrics == nullptr) return false;
|
if (metrics == nullptr) return false;
|
||||||
metrics_->Serialize(metrics);
|
metrics_->Serialize(metrics);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
CdmResponseType OpenSession(
|
CdmResponseType OpenSession(const CdmKeySystem& key_system,
|
||||||
const CdmKeySystem& key_system, CdmClientPropertySet* property_set,
|
CdmClientPropertySet* property_set,
|
||||||
const CdmSessionId& forced_session_id, WvCdmEventListener* event_listener)
|
const CdmSessionId& forced_session_id,
|
||||||
override {
|
WvCdmEventListener* event_listener) override {
|
||||||
CdmResponseType sts = T::OpenSession(
|
CdmResponseType sts = T::OpenSession(key_system, property_set,
|
||||||
key_system, property_set, forced_session_id, event_listener);
|
forced_session_id, event_listener);
|
||||||
metrics_->cdm_engine_open_session_.Increment(sts);
|
metrics_->cdm_engine_open_session_.Increment(sts);
|
||||||
return sts;
|
return sts;
|
||||||
}
|
}
|
||||||
|
|
||||||
CdmResponseType OpenSession(
|
CdmResponseType OpenSession(const CdmKeySystem& key_system,
|
||||||
const CdmKeySystem& key_system, CdmClientPropertySet* property_set,
|
CdmClientPropertySet* property_set,
|
||||||
WvCdmEventListener* event_listener, CdmSessionId* session_id)
|
WvCdmEventListener* event_listener,
|
||||||
override {
|
CdmSessionId* session_id) override {
|
||||||
CdmResponseType sts = T::OpenSession(
|
CdmResponseType sts =
|
||||||
key_system, property_set, event_listener, session_id);
|
T::OpenSession(key_system, property_set, event_listener, session_id);
|
||||||
metrics_->cdm_engine_open_session_.Increment(sts);
|
metrics_->cdm_engine_open_session_.Increment(sts);
|
||||||
return sts;
|
return sts;
|
||||||
}
|
}
|
||||||
@@ -96,27 +96,30 @@ class CdmEngineMetricsImpl : public T {
|
|||||||
CdmResponseType OpenKeySetSession(
|
CdmResponseType OpenKeySetSession(
|
||||||
const CdmKeySetId& key_set_id, CdmClientPropertySet* property_set,
|
const CdmKeySetId& key_set_id, CdmClientPropertySet* property_set,
|
||||||
WvCdmEventListener* event_listener) override {
|
WvCdmEventListener* event_listener) override {
|
||||||
CdmResponseType sts = T::OpenKeySetSession(key_set_id, property_set,
|
CdmResponseType sts =
|
||||||
event_listener);
|
T::OpenKeySetSession(key_set_id, property_set, event_listener);
|
||||||
metrics_->cdm_engine_open_key_set_session_.Increment(sts);
|
metrics_->cdm_engine_open_key_set_session_.Increment(sts);
|
||||||
return sts;
|
return sts;
|
||||||
}
|
}
|
||||||
|
|
||||||
CdmResponseType GenerateKeyRequest(
|
CdmResponseType GenerateKeyRequest(const CdmSessionId& session_id,
|
||||||
const CdmSessionId& session_id, const CdmKeySetId& key_set_id,
|
const CdmKeySetId& key_set_id,
|
||||||
const InitializationData& init_data, const CdmLicenseType license_type,
|
const InitializationData& init_data,
|
||||||
CdmAppParameterMap& app_parameters, CdmKeyRequest* key_request) override {
|
const CdmLicenseType license_type,
|
||||||
|
CdmAppParameterMap& app_parameters,
|
||||||
|
CdmKeyRequest* key_request) override {
|
||||||
CdmResponseType sts;
|
CdmResponseType sts;
|
||||||
M_TIME(sts = T::GenerateKeyRequest(session_id, key_set_id, init_data,
|
M_TIME(
|
||||||
license_type, app_parameters,
|
sts = T::GenerateKeyRequest(session_id, key_set_id, init_data,
|
||||||
key_request),
|
license_type, app_parameters, key_request),
|
||||||
metrics_, cdm_engine_generate_key_request_, sts, license_type);
|
metrics_, cdm_engine_generate_key_request_, sts, license_type);
|
||||||
return sts;
|
return sts;
|
||||||
}
|
}
|
||||||
|
|
||||||
CdmResponseType AddKey(
|
CdmResponseType AddKey(const CdmSessionId& session_id,
|
||||||
const CdmSessionId& session_id, const CdmKeyResponse& key_data,
|
const CdmKeyResponse& key_data,
|
||||||
CdmLicenseType* license_type, CdmKeySetId* key_set_id) override {
|
CdmLicenseType* license_type,
|
||||||
|
CdmKeySetId* key_set_id) override {
|
||||||
if (license_type == nullptr) {
|
if (license_type == nullptr) {
|
||||||
LOGE("CdmEngine::AddKey: license_type cannot be null.");
|
LOGE("CdmEngine::AddKey: license_type cannot be null.");
|
||||||
return PARAMETER_NULL;
|
return PARAMETER_NULL;
|
||||||
@@ -128,12 +131,11 @@ class CdmEngineMetricsImpl : public T {
|
|||||||
return sts;
|
return sts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CdmResponseType RestoreKey(const CdmSessionId& session_id,
|
CdmResponseType RestoreKey(const CdmSessionId& session_id,
|
||||||
const CdmKeySetId& key_set_id) override {
|
const CdmKeySetId& key_set_id) override {
|
||||||
CdmResponseType sts;
|
CdmResponseType sts;
|
||||||
M_TIME(sts = T::RestoreKey(session_id, key_set_id),
|
M_TIME(sts = T::RestoreKey(session_id, key_set_id), metrics_,
|
||||||
metrics_, cdm_engine_restore_key_, sts);
|
cdm_engine_restore_key_, sts);
|
||||||
return sts;
|
return sts;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,19 +148,20 @@ class CdmEngineMetricsImpl : public T {
|
|||||||
CdmResponseType QueryKeyStatus(const CdmSessionId& session_id,
|
CdmResponseType QueryKeyStatus(const CdmSessionId& session_id,
|
||||||
CdmQueryMap* query_response) override {
|
CdmQueryMap* query_response) override {
|
||||||
CdmResponseType sts;
|
CdmResponseType sts;
|
||||||
M_TIME(sts = T::QueryKeyStatus(session_id, query_response),
|
M_TIME(sts = T::QueryKeyStatus(session_id, query_response), metrics_,
|
||||||
metrics_, cdm_engine_query_key_status_, sts);
|
cdm_engine_query_key_status_, sts);
|
||||||
return sts;
|
return sts;
|
||||||
}
|
}
|
||||||
|
|
||||||
CdmResponseType GetProvisioningRequest(
|
CdmResponseType GetProvisioningRequest(CdmCertificateType cert_type,
|
||||||
CdmCertificateType cert_type, const std::string& cert_authority,
|
const std::string& cert_authority,
|
||||||
const std::string& service_certificate,
|
const std::string& service_certificate,
|
||||||
CdmProvisioningRequest* request, std::string* default_url) override {
|
CdmProvisioningRequest* request,
|
||||||
|
std::string* default_url) override {
|
||||||
CdmResponseType sts;
|
CdmResponseType sts;
|
||||||
M_TIME(sts = T::GetProvisioningRequest(cert_type, cert_authority,
|
M_TIME(sts = T::GetProvisioningRequest(cert_type, cert_authority,
|
||||||
service_certificate,
|
service_certificate, request,
|
||||||
request, default_url),
|
default_url),
|
||||||
metrics_, cdm_engine_get_provisioning_request_, sts);
|
metrics_, cdm_engine_get_provisioning_request_, sts);
|
||||||
return sts;
|
return sts;
|
||||||
}
|
}
|
||||||
@@ -167,21 +170,18 @@ class CdmEngineMetricsImpl : public T {
|
|||||||
const CdmProvisioningResponse& response, std::string* cert,
|
const CdmProvisioningResponse& response, std::string* cert,
|
||||||
std::string* wrapped_key) override {
|
std::string* wrapped_key) override {
|
||||||
CdmResponseType sts;
|
CdmResponseType sts;
|
||||||
M_TIME(
|
M_TIME(sts = T::HandleProvisioningResponse(response, cert, wrapped_key),
|
||||||
sts = T::HandleProvisioningResponse(response, cert, wrapped_key),
|
metrics_, cdm_engine_handle_provisioning_response_, sts);
|
||||||
metrics_, cdm_engine_handle_provisioning_response_, sts);
|
|
||||||
return sts;
|
return sts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CdmResponseType Unprovision(CdmSecurityLevel security_level) override {
|
CdmResponseType Unprovision(CdmSecurityLevel security_level) override {
|
||||||
CdmResponseType sts = T::Unprovision(security_level);
|
CdmResponseType sts = T::Unprovision(security_level);
|
||||||
metrics_->cdm_engine_unprovision_.Increment(sts, security_level);
|
metrics_->cdm_engine_unprovision_.Increment(sts, security_level);
|
||||||
return sts;
|
return sts;
|
||||||
}
|
}
|
||||||
|
|
||||||
CdmResponseType GetUsageInfo(const std::string& app_id,
|
CdmResponseType GetUsageInfo(const std::string& app_id, int* error_detail,
|
||||||
int* error_detail,
|
|
||||||
CdmUsageInfo* usage_info) override {
|
CdmUsageInfo* usage_info) override {
|
||||||
CdmResponseType sts;
|
CdmResponseType sts;
|
||||||
int error_detail_alt;
|
int error_detail_alt;
|
||||||
@@ -193,10 +193,8 @@ class CdmEngineMetricsImpl : public T {
|
|||||||
return sts;
|
return sts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CdmResponseType GetUsageInfo(const std::string& app_id,
|
CdmResponseType GetUsageInfo(const std::string& app_id,
|
||||||
const CdmSecureStopId& ssid,
|
const CdmSecureStopId& ssid, int* error_detail,
|
||||||
int* error_detail,
|
|
||||||
CdmUsageInfo* usage_info) override {
|
CdmUsageInfo* usage_info) override {
|
||||||
CdmResponseType sts;
|
CdmResponseType sts;
|
||||||
int error_detail_alt;
|
int error_detail_alt;
|
||||||
@@ -222,15 +220,15 @@ class CdmEngineMetricsImpl : public T {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CdmResponseType RemoveUsageInfo(
|
CdmResponseType RemoveUsageInfo(
|
||||||
const std::string& app_id, const CdmSecureStopId& secure_stop_id)
|
const std::string& app_id,
|
||||||
override {
|
const CdmSecureStopId& secure_stop_id) override {
|
||||||
CdmResponseType sts = T::RemoveUsageInfo(app_id, secure_stop_id);
|
CdmResponseType sts = T::RemoveUsageInfo(app_id, secure_stop_id);
|
||||||
metrics_->cdm_engine_remove_usage_info_.Increment(sts);
|
metrics_->cdm_engine_remove_usage_info_.Increment(sts);
|
||||||
return sts;
|
return sts;
|
||||||
}
|
}
|
||||||
|
|
||||||
CdmResponseType ReleaseUsageInfo(const CdmUsageInfoReleaseMessage& message)
|
CdmResponseType ReleaseUsageInfo(
|
||||||
override {
|
const CdmUsageInfoReleaseMessage& message) override {
|
||||||
CdmResponseType sts = T::ReleaseUsageInfo(message);
|
CdmResponseType sts = T::ReleaseUsageInfo(message);
|
||||||
metrics_->cdm_engine_release_usage_info_.Increment(sts);
|
metrics_->cdm_engine_release_usage_info_.Increment(sts);
|
||||||
return sts;
|
return sts;
|
||||||
@@ -240,17 +238,15 @@ class CdmEngineMetricsImpl : public T {
|
|||||||
const std::string& app_id, CdmSecurityLevel security_level,
|
const std::string& app_id, CdmSecurityLevel security_level,
|
||||||
std::vector<std::string>* ksids,
|
std::vector<std::string>* ksids,
|
||||||
std::vector<std::string>* provider_session_tokens) override {
|
std::vector<std::string>* provider_session_tokens) override {
|
||||||
CdmResponseType sts = T::ListUsageIds(app_id, security_level,
|
CdmResponseType sts =
|
||||||
ksids, provider_session_tokens);
|
T::ListUsageIds(app_id, security_level, ksids, provider_session_tokens);
|
||||||
metrics_->cdm_engine_get_secure_stop_ids_.Increment(sts);
|
metrics_->cdm_engine_get_secure_stop_ids_.Increment(sts);
|
||||||
return sts;
|
return sts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FindSessionForKey(const KeyId& key_id,
|
||||||
bool FindSessionForKey(const KeyId& key_id, CdmSessionId* session_id)
|
CdmSessionId* session_id) override {
|
||||||
override {
|
bool status = T::FindSessionForKey(key_id, session_id);
|
||||||
bool status =
|
|
||||||
T::FindSessionForKey(key_id, session_id);
|
|
||||||
metrics_->cdm_engine_find_session_for_key_.Increment(status);
|
metrics_->cdm_engine_find_session_for_key_.Increment(status);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@@ -258,8 +254,8 @@ class CdmEngineMetricsImpl : public T {
|
|||||||
CdmResponseType Decrypt(const CdmSessionId& session_id,
|
CdmResponseType Decrypt(const CdmSessionId& session_id,
|
||||||
const CdmDecryptionParameters& parameters) override {
|
const CdmDecryptionParameters& parameters) override {
|
||||||
CdmResponseType sts;
|
CdmResponseType sts;
|
||||||
M_TIME(sts = T::Decrypt(session_id, parameters),
|
M_TIME(sts = T::Decrypt(session_id, parameters), metrics_,
|
||||||
metrics_, cdm_engine_decrypt_, sts,
|
cdm_engine_decrypt_, sts,
|
||||||
metrics::Pow2Bucket(parameters.encrypt_length));
|
metrics::Pow2Bucket(parameters.encrypt_length));
|
||||||
return sts;
|
return sts;
|
||||||
}
|
}
|
||||||
@@ -269,5 +265,5 @@ class CdmEngineMetricsImpl : public T {
|
|||||||
Clock clock_;
|
Clock clock_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // wvcdm namespace
|
} // namespace wvcdm
|
||||||
#endif // WVCDM_CORE_CDM_ENGINE_METRICS_DECORATOR_H_
|
#endif // WVCDM_CORE_CDM_ENGINE_METRICS_DECORATOR_H_
|
||||||
|
|||||||
@@ -64,16 +64,15 @@ class CdmSession {
|
|||||||
// |license_type|. The |error_detail| will be filled with an internal error
|
// |license_type|. The |error_detail| will be filled with an internal error
|
||||||
// code. The |error_detail| may be a CdmResponseType or other error code type.
|
// code. The |error_detail| may be a CdmResponseType or other error code type.
|
||||||
// It is only suitable for additional logging or debugging.
|
// It is only suitable for additional logging or debugging.
|
||||||
virtual CdmResponseType RestoreOfflineSession(
|
virtual CdmResponseType RestoreOfflineSession(const CdmKeySetId& key_set_id,
|
||||||
const CdmKeySetId& key_set_id, CdmLicenseType license_type,
|
CdmLicenseType license_type,
|
||||||
int* error_detail);
|
int* error_detail);
|
||||||
// Restores an usage session from the provided |usage_data|.
|
// Restores an usage session from the provided |usage_data|.
|
||||||
// The |error_detail| will be filled with an internal error code. The
|
// The |error_detail| will be filled with an internal error code. The
|
||||||
// |error_detail| may be a CdmResponseType or other error code type. It is
|
// |error_detail| may be a CdmResponseType or other error code type. It is
|
||||||
// only suitable for additional logging or debugging.
|
// only suitable for additional logging or debugging.
|
||||||
virtual CdmResponseType RestoreUsageSession(
|
virtual CdmResponseType RestoreUsageSession(
|
||||||
const DeviceFiles::CdmUsageData& usage_data,
|
const DeviceFiles::CdmUsageData& usage_data, int* error_detail);
|
||||||
int* error_detail);
|
|
||||||
|
|
||||||
virtual const CdmSessionId& session_id() { return session_id_; }
|
virtual const CdmSessionId& session_id() { return session_id_; }
|
||||||
virtual const CdmKeySetId& key_set_id() { return key_set_id_; }
|
virtual const CdmKeySetId& key_set_id() { return key_set_id_; }
|
||||||
@@ -153,11 +152,12 @@ class CdmSession {
|
|||||||
virtual bool license_received() { return license_received_; }
|
virtual bool license_received() { return license_received_; }
|
||||||
virtual bool has_provider_session_token() {
|
virtual bool has_provider_session_token() {
|
||||||
return (license_parser_.get() != NULL &&
|
return (license_parser_.get() != NULL &&
|
||||||
license_parser_->provider_session_token().size() > 0);
|
license_parser_->provider_session_token().size() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual CdmUsageSupportType get_usage_support_type()
|
virtual CdmUsageSupportType get_usage_support_type() {
|
||||||
{ return usage_support_type_; }
|
return usage_support_type_;
|
||||||
|
}
|
||||||
|
|
||||||
// This method will remove keys by resetting crypto resources and
|
// This method will remove keys by resetting crypto resources and
|
||||||
// policy information. This renders the session mostly useless and it is
|
// policy information. This renders the session mostly useless and it is
|
||||||
@@ -218,8 +218,7 @@ class CdmSession {
|
|||||||
|
|
||||||
CdmResponseType StoreLicense();
|
CdmResponseType StoreLicense();
|
||||||
|
|
||||||
bool StoreLicense(DeviceFiles::LicenseState state,
|
bool StoreLicense(DeviceFiles::LicenseState state, int* error_detail);
|
||||||
int* error_detail);
|
|
||||||
|
|
||||||
bool UpdateUsageInfo();
|
bool UpdateUsageInfo();
|
||||||
|
|
||||||
|
|||||||
@@ -25,21 +25,23 @@ class ServiceCertificate;
|
|||||||
|
|
||||||
class CertificateProvisioning {
|
class CertificateProvisioning {
|
||||||
public:
|
public:
|
||||||
CertificateProvisioning(metrics::CryptoMetrics* metrics) :
|
CertificateProvisioning(metrics::CryptoMetrics* metrics)
|
||||||
crypto_session_(CryptoSession::MakeCryptoSession(metrics)),
|
: crypto_session_(CryptoSession::MakeCryptoSession(metrics)),
|
||||||
cert_type_(kCertificateWidevine),
|
cert_type_(kCertificateWidevine),
|
||||||
service_certificate_(new ServiceCertificate()) {}
|
service_certificate_(new ServiceCertificate()) {}
|
||||||
~CertificateProvisioning() {}
|
~CertificateProvisioning() {}
|
||||||
|
|
||||||
CdmResponseType Init(const std::string& service_certificate);
|
CdmResponseType Init(const std::string& service_certificate);
|
||||||
|
|
||||||
// Construct a valid provisioning request.
|
// Construct a valid provisioning request.
|
||||||
// The request will be sent to the provisioning server.
|
// The request will be sent to the provisioning server.
|
||||||
CdmResponseType GetProvisioningRequest(
|
CdmResponseType GetProvisioningRequest(SecurityLevel requested_security_level,
|
||||||
SecurityLevel requested_security_level, CdmCertificateType cert_type,
|
CdmCertificateType cert_type,
|
||||||
const std::string& cert_authority, const std::string& origin,
|
const std::string& cert_authority,
|
||||||
const std::string& spoid, CdmProvisioningRequest* request,
|
const std::string& origin,
|
||||||
std::string* default_url);
|
const std::string& spoid,
|
||||||
|
CdmProvisioningRequest* request,
|
||||||
|
std::string* default_url);
|
||||||
|
|
||||||
// Process the provisioning response.
|
// Process the provisioning response.
|
||||||
CdmResponseType HandleProvisioningResponse(
|
CdmResponseType HandleProvisioningResponse(
|
||||||
@@ -48,12 +50,11 @@ class CertificateProvisioning {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
CdmResponseType SetSpoidParameter(
|
CdmResponseType SetSpoidParameter(
|
||||||
const std::string& origin,
|
const std::string& origin, const std::string& spoid,
|
||||||
const std::string& spoid,
|
|
||||||
video_widevine::ProvisioningRequest* request);
|
video_widevine::ProvisioningRequest* request);
|
||||||
|
|
||||||
video_widevine::SignedProvisioningMessage::ProtocolVersion
|
video_widevine::SignedProvisioningMessage::ProtocolVersion
|
||||||
GetProtocolVersion();
|
GetProtocolVersion();
|
||||||
|
|
||||||
std::unique_ptr<CryptoSession> crypto_session_;
|
std::unique_ptr<CryptoSession> crypto_session_;
|
||||||
CdmCertificateType cert_type_;
|
CdmCertificateType cert_type_;
|
||||||
|
|||||||
@@ -11,15 +11,15 @@ namespace wvcdm {
|
|||||||
|
|
||||||
class CryptoKey {
|
class CryptoKey {
|
||||||
public:
|
public:
|
||||||
CryptoKey() {};
|
CryptoKey(){};
|
||||||
~CryptoKey() {};
|
~CryptoKey(){};
|
||||||
|
|
||||||
const std::string& key_id() const { return key_id_; }
|
const std::string& key_id() const { return key_id_; }
|
||||||
const std::string& key_data() const { return key_data_; }
|
const std::string& key_data() const { return key_data_; }
|
||||||
const std::string& key_data_iv() const { return key_data_iv_; }
|
const std::string& key_data_iv() const { return key_data_iv_; }
|
||||||
const std::string& key_control() const { return key_control_; }
|
const std::string& key_control() const { return key_control_; }
|
||||||
const std::string& key_control_iv() const { return key_control_iv_; }
|
const std::string& key_control_iv() const { return key_control_iv_; }
|
||||||
const std::string& entitlement_key_id() const {return entitlement_key_id_;}
|
const std::string& entitlement_key_id() const { return entitlement_key_id_; }
|
||||||
const std::string& track_label() const { return track_label_; }
|
const std::string& track_label() const { return track_label_; }
|
||||||
CdmCipherMode cipher_mode() const { return cipher_mode_; }
|
CdmCipherMode cipher_mode() const { return cipher_mode_; }
|
||||||
void set_key_id(const std::string& key_id) { key_id_ = key_id; }
|
void set_key_id(const std::string& key_id) { key_id_ = key_id; }
|
||||||
|
|||||||
@@ -96,32 +96,31 @@ class CryptoSession {
|
|||||||
std::string* signature);
|
std::string* signature);
|
||||||
virtual CdmResponseType PrepareRenewalRequest(const std::string& message,
|
virtual CdmResponseType PrepareRenewalRequest(const std::string& message,
|
||||||
std::string* signature);
|
std::string* signature);
|
||||||
virtual CdmResponseType LoadKeys(
|
virtual CdmResponseType LoadKeys(const std::string& message,
|
||||||
const std::string& message, const std::string& signature,
|
const std::string& signature,
|
||||||
const std::string& mac_key_iv, const std::string& mac_key,
|
const std::string& mac_key_iv,
|
||||||
const std::vector<CryptoKey>& key_array,
|
const std::string& mac_key,
|
||||||
const std::string& provider_session_token,
|
const std::vector<CryptoKey>& key_array,
|
||||||
const std::string& srm_requirement,
|
const std::string& provider_session_token,
|
||||||
CdmLicenseKeyType key_type);
|
const std::string& srm_requirement,
|
||||||
|
CdmLicenseKeyType key_type);
|
||||||
virtual CdmResponseType LoadEntitledContentKeys(
|
virtual CdmResponseType LoadEntitledContentKeys(
|
||||||
const std::vector<CryptoKey>& key_array);
|
const std::vector<CryptoKey>& key_array);
|
||||||
virtual CdmResponseType LoadCertificatePrivateKey(std::string& wrapped_key);
|
virtual CdmResponseType LoadCertificatePrivateKey(std::string& wrapped_key);
|
||||||
virtual CdmResponseType RefreshKeys(const std::string& message,
|
virtual CdmResponseType RefreshKeys(const std::string& message,
|
||||||
const std::string& signature,
|
const std::string& signature,
|
||||||
int num_keys,
|
int num_keys, const CryptoKey* key_array);
|
||||||
const CryptoKey* key_array);
|
|
||||||
virtual CdmResponseType GenerateNonce(uint32_t* nonce);
|
virtual CdmResponseType GenerateNonce(uint32_t* nonce);
|
||||||
virtual CdmResponseType GenerateDerivedKeys(const std::string& message);
|
virtual CdmResponseType GenerateDerivedKeys(const std::string& message);
|
||||||
virtual CdmResponseType GenerateDerivedKeys(const std::string& message,
|
virtual CdmResponseType GenerateDerivedKeys(const std::string& message,
|
||||||
const std::string& session_key);
|
const std::string& session_key);
|
||||||
virtual CdmResponseType RewrapCertificate(
|
virtual CdmResponseType RewrapCertificate(const std::string& signed_message,
|
||||||
const std::string& signed_message,
|
const std::string& signature,
|
||||||
const std::string& signature,
|
const std::string& nonce,
|
||||||
const std::string& nonce,
|
const std::string& private_key,
|
||||||
const std::string& private_key,
|
const std::string& iv,
|
||||||
const std::string& iv,
|
const std::string& wrapping_key,
|
||||||
const std::string& wrapping_key,
|
std::string* wrapped_private_key);
|
||||||
std::string* wrapped_private_key);
|
|
||||||
|
|
||||||
// Media data path
|
// Media data path
|
||||||
virtual CdmResponseType Decrypt(const CdmDecryptionParameters& params);
|
virtual CdmResponseType Decrypt(const CdmDecryptionParameters& params);
|
||||||
@@ -237,8 +236,7 @@ class CryptoSession {
|
|||||||
virtual metrics::CryptoMetrics* GetCryptoMetrics() { return metrics_; }
|
virtual metrics::CryptoMetrics* GetCryptoMetrics() { return metrics_; }
|
||||||
|
|
||||||
virtual CdmResponseType GetProvisioningMethod(
|
virtual CdmResponseType GetProvisioningMethod(
|
||||||
SecurityLevel requested_security_level,
|
SecurityLevel requested_security_level, CdmClientTokenType* token_type);
|
||||||
CdmClientTokenType* token_type);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Creates an instance of CryptoSession with the given |crypto_metrics|.
|
// Creates an instance of CryptoSession with the given |crypto_metrics|.
|
||||||
@@ -269,8 +267,8 @@ class CryptoSession {
|
|||||||
static bool ExtractSystemIdFromOemCert(const std::string& oem_cert,
|
static bool ExtractSystemIdFromOemCert(const std::string& oem_cert,
|
||||||
uint32_t* system_id);
|
uint32_t* system_id);
|
||||||
CdmResponseType GetSystemIdInternal(uint32_t* system_id);
|
CdmResponseType GetSystemIdInternal(uint32_t* system_id);
|
||||||
CdmResponseType GenerateSignature(
|
CdmResponseType GenerateSignature(const std::string& message,
|
||||||
const std::string& message, std::string* signature);
|
std::string* signature);
|
||||||
CdmResponseType GenerateRsaSignature(const std::string& message,
|
CdmResponseType GenerateRsaSignature(const std::string& message,
|
||||||
std::string* signature);
|
std::string* signature);
|
||||||
|
|
||||||
|
|||||||
@@ -79,21 +79,17 @@ class DeviceFiles {
|
|||||||
virtual bool HasCertificate();
|
virtual bool HasCertificate();
|
||||||
virtual bool RemoveCertificate();
|
virtual bool RemoveCertificate();
|
||||||
|
|
||||||
virtual bool StoreLicense(const std::string& key_set_id,
|
virtual bool StoreLicense(
|
||||||
const LicenseState state,
|
const std::string& key_set_id, const LicenseState state,
|
||||||
const CdmInitData& pssh_data,
|
const CdmInitData& pssh_data, const CdmKeyMessage& key_request,
|
||||||
const CdmKeyMessage& key_request,
|
const CdmKeyResponse& key_response,
|
||||||
const CdmKeyResponse& key_response,
|
const CdmKeyMessage& key_renewal_request,
|
||||||
const CdmKeyMessage& key_renewal_request,
|
const CdmKeyResponse& key_renewal_response,
|
||||||
const CdmKeyResponse& key_renewal_response,
|
const std::string& release_server_url, int64_t playback_start_time,
|
||||||
const std::string& release_server_url,
|
int64_t last_playback_time, int64_t grace_period_end_time,
|
||||||
int64_t playback_start_time,
|
const CdmAppParameterMap& app_parameters,
|
||||||
int64_t last_playback_time,
|
const CdmUsageEntry& usage_entry, uint32_t usage_entry_number,
|
||||||
int64_t grace_period_end_time,
|
ResponseType* result);
|
||||||
const CdmAppParameterMap& app_parameters,
|
|
||||||
const CdmUsageEntry& usage_entry,
|
|
||||||
uint32_t usage_entry_number,
|
|
||||||
ResponseType* result);
|
|
||||||
|
|
||||||
virtual bool RetrieveLicense(
|
virtual bool RetrieveLicense(
|
||||||
const std::string& key_set_id, LicenseState* state,
|
const std::string& key_set_id, LicenseState* state,
|
||||||
@@ -135,10 +131,9 @@ class DeviceFiles {
|
|||||||
// Retrieve usage identifying information stored on the file system.
|
// Retrieve usage identifying information stored on the file system.
|
||||||
// The caller needs to specify at least one of |ksids| or
|
// The caller needs to specify at least one of |ksids| or
|
||||||
// |provider_session_tokens|
|
// |provider_session_tokens|
|
||||||
virtual bool ListUsageIds(
|
virtual bool ListUsageIds(const std::string& app_id,
|
||||||
const std::string& app_id,
|
std::vector<std::string>* ksids,
|
||||||
std::vector<std::string>* ksids,
|
std::vector<std::string>* provider_session_tokens);
|
||||||
std::vector<std::string>* provider_session_tokens);
|
|
||||||
|
|
||||||
// Get the provider session token for the given key_set_id.
|
// Get the provider session token for the given key_set_id.
|
||||||
virtual bool GetProviderSessionToken(const std::string& app_id,
|
virtual bool GetProviderSessionToken(const std::string& app_id,
|
||||||
@@ -173,12 +168,9 @@ class DeviceFiles {
|
|||||||
// Retrieve the usage info entry specified by |key_set_id|.
|
// Retrieve the usage info entry specified by |key_set_id|.
|
||||||
// Returns false if the entry could not be found.
|
// Returns false if the entry could not be found.
|
||||||
virtual bool RetrieveUsageInfoByKeySetId(
|
virtual bool RetrieveUsageInfoByKeySetId(
|
||||||
const std::string& usage_info_file_name,
|
const std::string& usage_info_file_name, const std::string& key_set_id,
|
||||||
const std::string& key_set_id,
|
std::string* provider_session_token, CdmKeyMessage* license_request,
|
||||||
std::string* provider_session_token,
|
CdmKeyResponse* license_response, CdmUsageEntry* usage_entry,
|
||||||
CdmKeyMessage* license_request,
|
|
||||||
CdmKeyResponse* license_response,
|
|
||||||
CdmUsageEntry* usage_entry,
|
|
||||||
uint32_t* usage_entry_number);
|
uint32_t* usage_entry_number);
|
||||||
|
|
||||||
// These APIs support upgrading from usage tables to usage tabler header +
|
// These APIs support upgrading from usage tables to usage tabler header +
|
||||||
@@ -218,8 +210,7 @@ class DeviceFiles {
|
|||||||
private:
|
private:
|
||||||
// Extract serial number and system ID from DRM Device certificate
|
// Extract serial number and system ID from DRM Device certificate
|
||||||
bool ExtractDeviceInfo(const std::string& device_certificate,
|
bool ExtractDeviceInfo(const std::string& device_certificate,
|
||||||
std::string* serial_number,
|
std::string* serial_number, uint32_t* system_id);
|
||||||
uint32_t* system_id);
|
|
||||||
|
|
||||||
// Helpers that wrap the File interface and automatically handle hashing, as
|
// Helpers that wrap the File interface and automatically handle hashing, as
|
||||||
// well as adding the device files base path to to the file name.
|
// well as adding the device files base path to to the file name.
|
||||||
|
|||||||
@@ -38,13 +38,11 @@ class InitializationData {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool SelectWidevinePssh(const CdmInitData& init_data,
|
bool SelectWidevinePssh(const CdmInitData& init_data,
|
||||||
bool prefer_entitlements,
|
bool prefer_entitlements, CdmInitData* output);
|
||||||
CdmInitData* output);
|
|
||||||
// Helpers used by SelectWidevinePssh().
|
// Helpers used by SelectWidevinePssh().
|
||||||
bool ExtractWidevinePsshs(const CdmInitData& init_data,
|
bool ExtractWidevinePsshs(const CdmInitData& init_data,
|
||||||
std::vector<CdmInitData>* psshs);
|
std::vector<CdmInitData>* psshs);
|
||||||
bool ExtractWidevinePsshData(const uint8_t* data,
|
bool ExtractWidevinePsshData(const uint8_t* data, size_t length,
|
||||||
size_t length,
|
|
||||||
CdmInitData* output);
|
CdmInitData* output);
|
||||||
|
|
||||||
bool ExtractHlsAttributes(const std::string& attribute_list,
|
bool ExtractHlsAttributes(const std::string& attribute_list,
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "metrics_collections.h"
|
|
||||||
#include "OEMCryptoCENC.h"
|
#include "OEMCryptoCENC.h"
|
||||||
|
#include "metrics_collections.h"
|
||||||
#include "wv_cdm_types.h"
|
#include "wv_cdm_types.h"
|
||||||
|
|
||||||
namespace wvcdm {
|
namespace wvcdm {
|
||||||
@@ -25,8 +25,7 @@ class KeySession {
|
|||||||
virtual KeySessionType Type() = 0;
|
virtual KeySessionType Type() = 0;
|
||||||
virtual OEMCryptoResult GenerateDerivedKeys(const std::string& message) = 0;
|
virtual OEMCryptoResult GenerateDerivedKeys(const std::string& message) = 0;
|
||||||
virtual OEMCryptoResult GenerateDerivedKeys(
|
virtual OEMCryptoResult GenerateDerivedKeys(
|
||||||
const std::string& message,
|
const std::string& message, const std::string& session_key) = 0;
|
||||||
const std::string& session_key) = 0;
|
|
||||||
virtual OEMCryptoResult LoadKeys(const std::string& message,
|
virtual OEMCryptoResult LoadKeys(const std::string& message,
|
||||||
const std::string& signature,
|
const std::string& signature,
|
||||||
const std::string& mac_key_iv,
|
const std::string& mac_key_iv,
|
||||||
|
|||||||
@@ -72,8 +72,9 @@ class LicenseKeys {
|
|||||||
const std::vector<WidevinePsshData_EntitledKey>& keys);
|
const std::vector<WidevinePsshData_EntitledKey>& keys);
|
||||||
|
|
||||||
// For test use: Sets the OEMCrypto security level
|
// For test use: Sets the OEMCrypto security level
|
||||||
virtual void SetSecurityLevelForTest(
|
virtual void SetSecurityLevelForTest(CdmSecurityLevel security_level) {
|
||||||
CdmSecurityLevel security_level) { security_level_ = security_level; }
|
security_level_ = security_level;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef ::video_widevine::License::KeyContainer KeyContainer;
|
typedef ::video_widevine::License::KeyContainer KeyContainer;
|
||||||
@@ -126,7 +127,8 @@ class LicenseKeyStatus {
|
|||||||
|
|
||||||
// Indicates whether a key can be used for a given security level
|
// Indicates whether a key can be used for a given security level
|
||||||
virtual bool MeetsSecurityLevelConstraints() const {
|
virtual bool MeetsSecurityLevelConstraints() const {
|
||||||
return meets_security_level_constraints_; }
|
return meets_security_level_constraints_;
|
||||||
|
}
|
||||||
|
|
||||||
// Applies the given changes in resolution or HDCP settings.
|
// Applies the given changes in resolution or HDCP settings.
|
||||||
virtual void ApplyConstraints(uint32_t new_resolution,
|
virtual void ApplyConstraints(uint32_t new_resolution,
|
||||||
|
|||||||
@@ -47,11 +47,11 @@ OEMCryptoResult OEMCrypto_ShrinkUsageTableHeader(SecurityLevel level,
|
|||||||
uint32_t new_table_size,
|
uint32_t new_table_size,
|
||||||
uint8_t* header_buffer,
|
uint8_t* header_buffer,
|
||||||
size_t* header_buffer_length);
|
size_t* header_buffer_length);
|
||||||
OEMCryptoResult OEMCrypto_CreateOldUsageEntry(SecurityLevel level,
|
OEMCryptoResult OEMCrypto_CreateOldUsageEntry(
|
||||||
uint64_t time_since_license_received, uint64_t time_since_first_decrypt,
|
SecurityLevel level, uint64_t time_since_license_received,
|
||||||
uint64_t time_since_last_decrypt, OEMCrypto_Usage_Entry_Status status,
|
uint64_t time_since_first_decrypt, uint64_t time_since_last_decrypt,
|
||||||
uint8_t* server_mac_key, uint8_t* client_mac_key, const uint8_t* pst,
|
OEMCrypto_Usage_Entry_Status status, uint8_t* server_mac_key,
|
||||||
size_t pst_length);
|
uint8_t* client_mac_key, const uint8_t* pst, size_t pst_length);
|
||||||
uint32_t OEMCrypto_GetAnalogOutputFlags(SecurityLevel level);
|
uint32_t OEMCrypto_GetAnalogOutputFlags(SecurityLevel level);
|
||||||
const char* OEMCrypto_BuildInformation(SecurityLevel level);
|
const char* OEMCrypto_BuildInformation(SecurityLevel level);
|
||||||
uint32_t OEMCrypto_ResourceRatingTier(SecurityLevel level);
|
uint32_t OEMCrypto_ResourceRatingTier(SecurityLevel level);
|
||||||
@@ -107,7 +107,7 @@ OEMCryptoResult OEMCrypto_LoadKeys_Back_Compat(
|
|||||||
OEMCryptoResult OEMCrypto_UpdateUsageTable();
|
OEMCryptoResult OEMCrypto_UpdateUsageTable();
|
||||||
|
|
||||||
OEMCryptoResult OEMCrypto_DeactivateUsageEntry_V12(const uint8_t* pst,
|
OEMCryptoResult OEMCrypto_DeactivateUsageEntry_V12(const uint8_t* pst,
|
||||||
size_t pst_length);
|
size_t pst_length);
|
||||||
OEMCryptoResult OEMCrypto_DeleteUsageEntry(
|
OEMCryptoResult OEMCrypto_DeleteUsageEntry(
|
||||||
OEMCrypto_SESSION session, const uint8_t* pst, size_t pst_length,
|
OEMCrypto_SESSION session, const uint8_t* pst, size_t pst_length,
|
||||||
const uint8_t* message, size_t message_length, const uint8_t* signature,
|
const uint8_t* message, size_t message_length, const uint8_t* signature,
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ class RsaPublicKey {
|
|||||||
CORE_DISALLOW_COPY_AND_ASSIGN(RsaPublicKey);
|
CORE_DISALLOW_COPY_AND_ASSIGN(RsaPublicKey);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracts an integer value from the extensions in a certificate.
|
* Extracts an integer value from the extensions in a certificate.
|
||||||
* @param cert A PKCS7 encoded X.509 certificate chain.
|
* @param cert A PKCS7 encoded X.509 certificate chain.
|
||||||
|
|||||||
@@ -20,8 +20,7 @@
|
|||||||
|
|
||||||
namespace wvcdm {
|
namespace wvcdm {
|
||||||
|
|
||||||
typedef std::map<CdmSessionId, CdmClientPropertySet*>
|
typedef std::map<CdmSessionId, CdmClientPropertySet*> CdmClientPropertySetMap;
|
||||||
CdmClientPropertySetMap;
|
|
||||||
|
|
||||||
// This class saves information about features and properties enabled
|
// This class saves information about features and properties enabled
|
||||||
// for a given platform. At initialization it initializes properties from
|
// for a given platform. At initialization it initializes properties from
|
||||||
@@ -67,7 +66,7 @@ class Properties {
|
|||||||
std::string* base_path);
|
std::string* base_path);
|
||||||
static bool GetFactoryKeyboxPath(std::string* keybox);
|
static bool GetFactoryKeyboxPath(std::string* keybox);
|
||||||
static bool GetOEMCryptoPath(std::string* library_name);
|
static bool GetOEMCryptoPath(std::string* library_name);
|
||||||
static bool GetSandboxId(std::string *sandbox_id);
|
static bool GetSandboxId(std::string* sandbox_id);
|
||||||
static bool AlwaysUseKeySetIds();
|
static bool AlwaysUseKeySetIds();
|
||||||
static bool UseProviderIdInProvisioningRequest();
|
static bool UseProviderIdInProvisioningRequest();
|
||||||
|
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ class ServiceCertificate {
|
|||||||
static bool GetRequest(CdmKeyMessage* request);
|
static bool GetRequest(CdmKeyMessage* request);
|
||||||
static CdmResponseType ParseResponse(const std::string& response,
|
static CdmResponseType ParseResponse(const std::string& response,
|
||||||
std::string* signed_certificate);
|
std::string* signed_certificate);
|
||||||
private:
|
|
||||||
|
|
||||||
|
private:
|
||||||
// Encrypt data using RSA with OAEP padding.
|
// Encrypt data using RSA with OAEP padding.
|
||||||
// |plaintext| is the data to be encrypted. |ciphertext| is a pointer to a
|
// |plaintext| is the data to be encrypted. |ciphertext| is a pointer to a
|
||||||
// string to contain the decrypted data on return, and may not be null.
|
// string to contain the decrypted data on return, and may not be null.
|
||||||
|
|||||||
@@ -59,8 +59,8 @@ class UsageTableHeader {
|
|||||||
const std::string& usage_info_filename,
|
const std::string& usage_info_filename,
|
||||||
uint32_t* usage_entry_number);
|
uint32_t* usage_entry_number);
|
||||||
virtual CdmResponseType LoadEntry(CryptoSession* crypto_session,
|
virtual CdmResponseType LoadEntry(CryptoSession* crypto_session,
|
||||||
const CdmUsageEntry& usage_entry,
|
const CdmUsageEntry& usage_entry,
|
||||||
uint32_t usage_entry_number);
|
uint32_t usage_entry_number);
|
||||||
virtual CdmResponseType UpdateEntry(CryptoSession* crypto_session,
|
virtual CdmResponseType UpdateEntry(CryptoSession* crypto_session,
|
||||||
CdmUsageEntry* usage_entry);
|
CdmUsageEntry* usage_entry);
|
||||||
|
|
||||||
|
|||||||
@@ -39,36 +39,34 @@ static const char KEY_SET_ID_PREFIX[] = "ksid";
|
|||||||
static const char KEY_SYSTEM[] = "com.widevine";
|
static const char KEY_SYSTEM[] = "com.widevine";
|
||||||
|
|
||||||
// define query keys, values here
|
// define query keys, values here
|
||||||
static const std::string QUERY_KEY_LICENSE_TYPE = "LicenseType";
|
static const std::string QUERY_KEY_LICENSE_TYPE =
|
||||||
// "Streaming", "Offline"
|
"LicenseType"; // "Streaming", "Offline"
|
||||||
static const std::string QUERY_KEY_PLAY_ALLOWED = "PlayAllowed";
|
static const std::string QUERY_KEY_PLAY_ALLOWED =
|
||||||
// "True", "False"
|
"PlayAllowed"; // "True", "False"
|
||||||
static const std::string QUERY_KEY_PERSIST_ALLOWED = "PersistAllowed";
|
static const std::string QUERY_KEY_PERSIST_ALLOWED =
|
||||||
// "True", "False"
|
"PersistAllowed"; // "True", "False"
|
||||||
static const std::string QUERY_KEY_RENEW_ALLOWED = "RenewAllowed";
|
static const std::string QUERY_KEY_RENEW_ALLOWED =
|
||||||
// "True", "False"
|
"RenewAllowed"; // "True", "False"
|
||||||
static const std::string QUERY_KEY_LICENSE_DURATION_REMAINING =
|
static const std::string QUERY_KEY_LICENSE_DURATION_REMAINING =
|
||||||
"LicenseDurationRemaining"; // non-negative integer denoting seconds
|
"LicenseDurationRemaining"; // non-negative integer denoting seconds
|
||||||
static const std::string QUERY_KEY_PLAYBACK_DURATION_REMAINING =
|
static const std::string QUERY_KEY_PLAYBACK_DURATION_REMAINING =
|
||||||
"PlaybackDurationRemaining"; // non-negative integer denoting seconds
|
"PlaybackDurationRemaining"; // non-negative integer denoting seconds
|
||||||
static const std::string QUERY_KEY_RENEWAL_SERVER_URL = "RenewalServerUrl";
|
static const std::string QUERY_KEY_RENEWAL_SERVER_URL =
|
||||||
// url
|
"RenewalServerUrl"; // url
|
||||||
static const std::string QUERY_KEY_OEMCRYPTO_SESSION_ID = "OemCryptoSessionId";
|
static const std::string QUERY_KEY_OEMCRYPTO_SESSION_ID =
|
||||||
// session id
|
"OemCryptoSessionId"; // session id
|
||||||
static const std::string QUERY_KEY_SECURITY_LEVEL = "SecurityLevel";
|
static const std::string QUERY_KEY_SECURITY_LEVEL =
|
||||||
// "L1", "L3"
|
"SecurityLevel"; // "L1", "L3"
|
||||||
static const std::string QUERY_KEY_DEVICE_ID = "DeviceID";
|
static const std::string QUERY_KEY_DEVICE_ID = "DeviceID"; // device unique id
|
||||||
// device unique id
|
static const std::string QUERY_KEY_SYSTEM_ID = "SystemID"; // system id
|
||||||
static const std::string QUERY_KEY_SYSTEM_ID = "SystemID";
|
static const std::string QUERY_KEY_PROVISIONING_ID =
|
||||||
// system id
|
"ProvisioningID"; // provisioning unique id
|
||||||
static const std::string QUERY_KEY_PROVISIONING_ID = "ProvisioningID";
|
static const std::string QUERY_KEY_CURRENT_HDCP_LEVEL =
|
||||||
// provisioning unique id
|
"HdcpLevel"; // current HDCP level
|
||||||
static const std::string QUERY_KEY_CURRENT_HDCP_LEVEL = "HdcpLevel";
|
static const std::string QUERY_KEY_MAX_HDCP_LEVEL =
|
||||||
// current HDCP level
|
"MaxHdcpLevel"; // maximum supported HDCP level
|
||||||
static const std::string QUERY_KEY_MAX_HDCP_LEVEL = "MaxHdcpLevel";
|
static const std::string QUERY_KEY_USAGE_SUPPORT =
|
||||||
// maximum supported HDCP level
|
"UsageSupport"; // whether usage reporting is supported
|
||||||
static const std::string QUERY_KEY_USAGE_SUPPORT = "UsageSupport";
|
|
||||||
// whether usage reporting is supported
|
|
||||||
static const std::string QUERY_KEY_NUMBER_OF_OPEN_SESSIONS =
|
static const std::string QUERY_KEY_NUMBER_OF_OPEN_SESSIONS =
|
||||||
"NumberOfOpenSessions";
|
"NumberOfOpenSessions";
|
||||||
static const std::string QUERY_KEY_MAX_NUMBER_OF_SESSIONS =
|
static const std::string QUERY_KEY_MAX_NUMBER_OF_SESSIONS =
|
||||||
@@ -76,14 +74,13 @@ static const std::string QUERY_KEY_MAX_NUMBER_OF_SESSIONS =
|
|||||||
static const std::string QUERY_KEY_OEMCRYPTO_API_VERSION =
|
static const std::string QUERY_KEY_OEMCRYPTO_API_VERSION =
|
||||||
"OemCryptoApiVersion";
|
"OemCryptoApiVersion";
|
||||||
static const std::string QUERY_KEY_CURRENT_SRM_VERSION = "CurrentSRMVersion";
|
static const std::string QUERY_KEY_CURRENT_SRM_VERSION = "CurrentSRMVersion";
|
||||||
static const std::string QUERY_KEY_SRM_UPDATE_SUPPORT = "SRMUpdateSupport";
|
static const std::string QUERY_KEY_SRM_UPDATE_SUPPORT =
|
||||||
// whether OEM supports SRM update
|
"SRMUpdateSupport"; // whether OEM supports SRM update
|
||||||
static const std::string QUERY_KEY_WVCDM_VERSION = "WidevineCdmVersion";
|
static const std::string QUERY_KEY_WVCDM_VERSION = "WidevineCdmVersion";
|
||||||
static const std::string QUERY_KEY_RESOURCE_RATING_TIER = "ResourceRatingTier";
|
static const std::string QUERY_KEY_RESOURCE_RATING_TIER = "ResourceRatingTier";
|
||||||
static const std::string QUERY_KEY_OEMCRYPTO_BUILD_INFORMATION =
|
static const std::string QUERY_KEY_OEMCRYPTO_BUILD_INFORMATION =
|
||||||
"OemCryptoBuildInformation";
|
"OemCryptoBuildInformation";
|
||||||
static const std::string QUERY_KEY_DECRYPT_HASH_SUPPORT =
|
static const std::string QUERY_KEY_DECRYPT_HASH_SUPPORT = "DecryptHashSupport";
|
||||||
"DecryptHashSupport";
|
|
||||||
|
|
||||||
static const std::string QUERY_VALUE_TRUE = "True";
|
static const std::string QUERY_VALUE_TRUE = "True";
|
||||||
static const std::string QUERY_VALUE_FALSE = "False";
|
static const std::string QUERY_VALUE_FALSE = "False";
|
||||||
@@ -125,7 +122,7 @@ static const std::string HLS_URI_ATTRIBUTE = "URI";
|
|||||||
static const char EMPTY_ORIGIN[] = "";
|
static const char EMPTY_ORIGIN[] = "";
|
||||||
static const char EMPTY_SPOID[] = "";
|
static const char EMPTY_SPOID[] = "";
|
||||||
|
|
||||||
//Policy engine HDCP enforcement
|
// Policy engine HDCP enforcement
|
||||||
static const uint32_t HDCP_UNSPECIFIED_VIDEO_RESOLUTION = 0;
|
static const uint32_t HDCP_UNSPECIFIED_VIDEO_RESOLUTION = 0;
|
||||||
static const int64_t HDCP_DEVICE_CHECK_INTERVAL = 10;
|
static const int64_t HDCP_DEVICE_CHECK_INTERVAL = 10;
|
||||||
static const char EMPTY_APP_PACKAGE_NAME[] = "";
|
static const char EMPTY_APP_PACKAGE_NAME[] = "";
|
||||||
|
|||||||
@@ -5,8 +5,9 @@
|
|||||||
#ifndef WVCDM_CORE_WV_CDM_TYPES_H_
|
#ifndef WVCDM_CORE_WV_CDM_TYPES_H_
|
||||||
#define WVCDM_CORE_WV_CDM_TYPES_H_
|
#define WVCDM_CORE_WV_CDM_TYPES_H_
|
||||||
|
|
||||||
#include <array>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <array>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|||||||
Reference in New Issue
Block a user