Source release 15.2.0
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#define WVCDM_CORE_BUFFER_READER_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#define WVCDM_CORE_CDM_CLIENT_PROPERTY_SET_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -33,30 +33,31 @@ class UsagePropertySet;
|
||||
class WvCdmEventListener;
|
||||
|
||||
// Keep expiration time for each key set
|
||||
typedef std::map<CdmKeySetId,
|
||||
std::pair<CdmSessionId, int64_t> > CdmReleaseKeySetMap;
|
||||
using CdmReleaseKeySetMap =
|
||||
std::map<CdmKeySetId, std::pair<CdmSessionId, int64_t> >;
|
||||
|
||||
class CdmEngine {
|
||||
public:
|
||||
virtual ~CdmEngine();
|
||||
|
||||
// Session related methods
|
||||
virtual CdmResponseType OpenSession(
|
||||
const CdmKeySystem& key_system, CdmClientPropertySet* property_set,
|
||||
const CdmSessionId& forced_session_id,
|
||||
WvCdmEventListener* event_listener);
|
||||
virtual CdmResponseType OpenSession(const CdmKeySystem& key_system,
|
||||
CdmClientPropertySet* property_set,
|
||||
const CdmSessionId& forced_session_id,
|
||||
WvCdmEventListener* event_listener);
|
||||
|
||||
virtual CdmResponseType OpenSession(
|
||||
const CdmKeySystem& key_system, CdmClientPropertySet* property_set,
|
||||
WvCdmEventListener* event_listener, CdmSessionId* session_id);
|
||||
virtual CdmResponseType OpenSession(const CdmKeySystem& key_system,
|
||||
CdmClientPropertySet* property_set,
|
||||
WvCdmEventListener* event_listener,
|
||||
CdmSessionId* session_id);
|
||||
|
||||
virtual CdmResponseType CloseSession(const CdmSessionId& session_id);
|
||||
|
||||
virtual bool IsOpenSession(const CdmSessionId& session_id);
|
||||
|
||||
virtual CdmResponseType OpenKeySetSession(
|
||||
const CdmKeySetId& key_set_id, CdmClientPropertySet* property_set,
|
||||
WvCdmEventListener* event_listener);
|
||||
virtual CdmResponseType OpenKeySetSession(const CdmKeySetId& key_set_id,
|
||||
CdmClientPropertySet* property_set,
|
||||
WvCdmEventListener* event_listener);
|
||||
|
||||
virtual CdmResponseType CloseKeySetSession(const CdmKeySetId& key_set_id);
|
||||
|
||||
@@ -129,8 +130,8 @@ class CdmEngine {
|
||||
virtual CdmResponseType RemoveLicense(const CdmSessionId& session_id);
|
||||
|
||||
// Construct valid renewal request for the current session keys.
|
||||
virtual CdmResponseType GenerateRenewalRequest(
|
||||
const CdmSessionId& session_id, CdmKeyRequest* key_request);
|
||||
virtual CdmResponseType GenerateRenewalRequest(const CdmSessionId& session_id,
|
||||
CdmKeyRequest* key_request);
|
||||
|
||||
// Accept renewal response and update key info.
|
||||
virtual CdmResponseType RenewKey(const CdmSessionId& session_id,
|
||||
@@ -174,8 +175,8 @@ class CdmEngine {
|
||||
// Generate and return a valid provisioning request.
|
||||
virtual CdmResponseType GetProvisioningRequest(
|
||||
CdmCertificateType cert_type, const std::string& cert_authority,
|
||||
const std::string& service_certificate,
|
||||
CdmProvisioningRequest* request, std::string* default_url);
|
||||
const std::string& service_certificate, CdmProvisioningRequest* request,
|
||||
std::string* default_url);
|
||||
|
||||
// Verify and process a provisioning response.
|
||||
virtual CdmResponseType HandleProvisioningResponse(
|
||||
@@ -214,14 +215,12 @@ class CdmEngine {
|
||||
|
||||
// Get offline license status: active, release or unknown
|
||||
virtual CdmResponseType GetOfflineLicenseState(
|
||||
const std::string& key_set_id,
|
||||
CdmSecurityLevel security_level,
|
||||
const std::string& key_set_id, CdmSecurityLevel security_level,
|
||||
CdmOfflineLicenseState* license_state);
|
||||
|
||||
// Remove offline license with the given key_set_id
|
||||
virtual CdmResponseType RemoveOfflineLicense(
|
||||
const std::string& key_set_id,
|
||||
CdmSecurityLevel security_level);
|
||||
virtual CdmResponseType RemoveOfflineLicense(const std::string& key_set_id,
|
||||
CdmSecurityLevel security_level);
|
||||
|
||||
// Usage related methods for streaming licenses
|
||||
// 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 RemoveUsageInfo(
|
||||
const std::string& app_id,
|
||||
const CdmSecureStopId& secure_stop_id);
|
||||
const std::string& app_id, const CdmSecureStopId& secure_stop_id);
|
||||
|
||||
virtual CdmResponseType ReleaseUsageInfo(
|
||||
const CdmUsageInfoReleaseMessage& message);
|
||||
@@ -266,16 +264,20 @@ class CdmEngine {
|
||||
// application can use outside of content stream processing
|
||||
|
||||
// Encrypts a buffer of app-level data.
|
||||
virtual CdmResponseType GenericEncrypt(
|
||||
const std::string& session_id, const std::string& in_buffer,
|
||||
const std::string& key_id, const std::string& iv,
|
||||
CdmEncryptionAlgorithm algorithm, std::string* out_buffer);
|
||||
virtual CdmResponseType GenericEncrypt(const std::string& session_id,
|
||||
const std::string& in_buffer,
|
||||
const std::string& key_id,
|
||||
const std::string& iv,
|
||||
CdmEncryptionAlgorithm algorithm,
|
||||
std::string* out_buffer);
|
||||
|
||||
// Decrypts a buffer of app-level data.
|
||||
virtual CdmResponseType GenericDecrypt(
|
||||
const std::string& session_id, const std::string& in_buffer,
|
||||
const std::string& key_id, const std::string& iv,
|
||||
CdmEncryptionAlgorithm algorithm, std::string* out_buffer);
|
||||
virtual CdmResponseType GenericDecrypt(const std::string& session_id,
|
||||
const std::string& in_buffer,
|
||||
const std::string& key_id,
|
||||
const std::string& iv,
|
||||
CdmEncryptionAlgorithm algorithm,
|
||||
std::string* out_buffer);
|
||||
|
||||
// Computes the signature for a message.
|
||||
virtual CdmResponseType GenericSign(const std::string& session_id,
|
||||
@@ -336,16 +338,14 @@ class CdmEngine {
|
||||
virtual void SetAppPackageName(const std::string& app_package_name) {
|
||||
app_package_name_ = app_package_name;
|
||||
}
|
||||
virtual const std::string& GetAppPackageName() {
|
||||
return app_package_name_;
|
||||
}
|
||||
virtual const std::string& GetAppPackageName() { return app_package_name_; }
|
||||
|
||||
protected:
|
||||
friend class CdmEngineFactory;
|
||||
friend class ParallelCdmTest;
|
||||
friend class WvCdmEnginePreProvTest;
|
||||
friend class WvCdmTestBase;
|
||||
friend class WvGenericOperationsTest;
|
||||
friend class WvGenericCryptoTest;
|
||||
friend class TestLicenseHolder;
|
||||
|
||||
CdmEngine(FileSystem* file_system,
|
||||
@@ -354,17 +354,17 @@ class CdmEngine {
|
||||
|
||||
private:
|
||||
// private methods
|
||||
CdmResponseType OpenSession(
|
||||
const CdmKeySystem& key_system, CdmClientPropertySet* property_set,
|
||||
WvCdmEventListener* event_listener, const CdmSessionId* forced_session_id,
|
||||
CdmSessionId* session_id);
|
||||
CdmResponseType OpenSession(const CdmKeySystem& key_system,
|
||||
CdmClientPropertySet* property_set,
|
||||
WvCdmEventListener* event_listener,
|
||||
const CdmSessionId* forced_session_id,
|
||||
CdmSessionId* session_id);
|
||||
|
||||
void DeleteAllUsageReportsUponFactoryReset();
|
||||
bool ValidateKeySystem(const CdmKeySystem& key_system);
|
||||
CdmResponseType GetUsageInfo(const std::string& app_id,
|
||||
SecurityLevel requested_security_level,
|
||||
int* error_detail,
|
||||
CdmUsageInfo* usage_info);
|
||||
int* error_detail, CdmUsageInfo* usage_info);
|
||||
|
||||
void OnKeyReleaseEvent(const CdmKeySetId& key_set_id);
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ class WvCdmEventListener;
|
||||
// FileSystem* file_system; // Construction of FileSystem object not shown.
|
||||
// std::shared_ptr<metrics::EngineMetrics> metrics(new EngineMetrics);
|
||||
// CdmEngine* e = new CdmEngineMetricsImpl<CdmEngine>(file_system, metrics);
|
||||
template<class T>
|
||||
template <class T>
|
||||
class CdmEngineMetricsImpl : public T {
|
||||
public:
|
||||
// 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) {
|
||||
metrics_->cdm_engine_creation_time_millis_.Record(clock_.GetCurrentTime());
|
||||
std::string cdm_version;
|
||||
if(Properties::GetWVCdmVersion(&cdm_version)) {
|
||||
if (Properties::GetWVCdmVersion(&cdm_version)) {
|
||||
metrics_->cdm_engine_cdm_version_.Record(cdm_version);
|
||||
} else {
|
||||
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;
|
||||
metrics_->Serialize(metrics);
|
||||
return true;
|
||||
}
|
||||
|
||||
CdmResponseType OpenSession(
|
||||
const CdmKeySystem& key_system, CdmClientPropertySet* property_set,
|
||||
const CdmSessionId& forced_session_id, WvCdmEventListener* event_listener)
|
||||
override {
|
||||
CdmResponseType sts = T::OpenSession(
|
||||
key_system, property_set, forced_session_id, event_listener);
|
||||
CdmResponseType OpenSession(const CdmKeySystem& key_system,
|
||||
CdmClientPropertySet* property_set,
|
||||
const CdmSessionId& forced_session_id,
|
||||
WvCdmEventListener* event_listener) override {
|
||||
CdmResponseType sts = T::OpenSession(key_system, property_set,
|
||||
forced_session_id, event_listener);
|
||||
metrics_->cdm_engine_open_session_.Increment(sts);
|
||||
return sts;
|
||||
}
|
||||
|
||||
CdmResponseType OpenSession(
|
||||
const CdmKeySystem& key_system, CdmClientPropertySet* property_set,
|
||||
WvCdmEventListener* event_listener, CdmSessionId* session_id)
|
||||
override {
|
||||
CdmResponseType sts = T::OpenSession(
|
||||
key_system, property_set, event_listener, session_id);
|
||||
CdmResponseType OpenSession(const CdmKeySystem& key_system,
|
||||
CdmClientPropertySet* property_set,
|
||||
WvCdmEventListener* event_listener,
|
||||
CdmSessionId* session_id) override {
|
||||
CdmResponseType sts =
|
||||
T::OpenSession(key_system, property_set, event_listener, session_id);
|
||||
metrics_->cdm_engine_open_session_.Increment(sts);
|
||||
return sts;
|
||||
}
|
||||
@@ -96,27 +96,30 @@ class CdmEngineMetricsImpl : public T {
|
||||
CdmResponseType OpenKeySetSession(
|
||||
const CdmKeySetId& key_set_id, CdmClientPropertySet* property_set,
|
||||
WvCdmEventListener* event_listener) override {
|
||||
CdmResponseType sts = T::OpenKeySetSession(key_set_id, property_set,
|
||||
event_listener);
|
||||
CdmResponseType sts =
|
||||
T::OpenKeySetSession(key_set_id, property_set, event_listener);
|
||||
metrics_->cdm_engine_open_key_set_session_.Increment(sts);
|
||||
return sts;
|
||||
}
|
||||
|
||||
CdmResponseType GenerateKeyRequest(
|
||||
const CdmSessionId& session_id, const CdmKeySetId& key_set_id,
|
||||
const InitializationData& init_data, const CdmLicenseType license_type,
|
||||
CdmAppParameterMap& app_parameters, CdmKeyRequest* key_request) override {
|
||||
CdmResponseType GenerateKeyRequest(const CdmSessionId& session_id,
|
||||
const CdmKeySetId& key_set_id,
|
||||
const InitializationData& init_data,
|
||||
const CdmLicenseType license_type,
|
||||
CdmAppParameterMap& app_parameters,
|
||||
CdmKeyRequest* key_request) override {
|
||||
CdmResponseType sts;
|
||||
M_TIME(sts = T::GenerateKeyRequest(session_id, key_set_id, init_data,
|
||||
license_type, app_parameters,
|
||||
key_request),
|
||||
metrics_, cdm_engine_generate_key_request_, sts, license_type);
|
||||
M_TIME(
|
||||
sts = T::GenerateKeyRequest(session_id, key_set_id, init_data,
|
||||
license_type, app_parameters, key_request),
|
||||
metrics_, cdm_engine_generate_key_request_, sts, license_type);
|
||||
return sts;
|
||||
}
|
||||
|
||||
CdmResponseType AddKey(
|
||||
const CdmSessionId& session_id, const CdmKeyResponse& key_data,
|
||||
CdmLicenseType* license_type, CdmKeySetId* key_set_id) override {
|
||||
CdmResponseType AddKey(const CdmSessionId& session_id,
|
||||
const CdmKeyResponse& key_data,
|
||||
CdmLicenseType* license_type,
|
||||
CdmKeySetId* key_set_id) override {
|
||||
if (license_type == nullptr) {
|
||||
LOGE("CdmEngine::AddKey: license_type cannot be null.");
|
||||
return PARAMETER_NULL;
|
||||
@@ -128,12 +131,11 @@ class CdmEngineMetricsImpl : public T {
|
||||
return sts;
|
||||
}
|
||||
|
||||
|
||||
CdmResponseType RestoreKey(const CdmSessionId& session_id,
|
||||
const CdmKeySetId& key_set_id) override {
|
||||
CdmResponseType sts;
|
||||
M_TIME(sts = T::RestoreKey(session_id, key_set_id),
|
||||
metrics_, cdm_engine_restore_key_, sts);
|
||||
M_TIME(sts = T::RestoreKey(session_id, key_set_id), metrics_,
|
||||
cdm_engine_restore_key_, sts);
|
||||
return sts;
|
||||
}
|
||||
|
||||
@@ -146,19 +148,20 @@ class CdmEngineMetricsImpl : public T {
|
||||
CdmResponseType QueryKeyStatus(const CdmSessionId& session_id,
|
||||
CdmQueryMap* query_response) override {
|
||||
CdmResponseType sts;
|
||||
M_TIME(sts = T::QueryKeyStatus(session_id, query_response),
|
||||
metrics_, cdm_engine_query_key_status_, sts);
|
||||
M_TIME(sts = T::QueryKeyStatus(session_id, query_response), metrics_,
|
||||
cdm_engine_query_key_status_, sts);
|
||||
return sts;
|
||||
}
|
||||
|
||||
CdmResponseType GetProvisioningRequest(
|
||||
CdmCertificateType cert_type, const std::string& cert_authority,
|
||||
const std::string& service_certificate,
|
||||
CdmProvisioningRequest* request, std::string* default_url) override {
|
||||
CdmResponseType GetProvisioningRequest(CdmCertificateType cert_type,
|
||||
const std::string& cert_authority,
|
||||
const std::string& service_certificate,
|
||||
CdmProvisioningRequest* request,
|
||||
std::string* default_url) override {
|
||||
CdmResponseType sts;
|
||||
M_TIME(sts = T::GetProvisioningRequest(cert_type, cert_authority,
|
||||
service_certificate,
|
||||
request, default_url),
|
||||
service_certificate, request,
|
||||
default_url),
|
||||
metrics_, cdm_engine_get_provisioning_request_, sts);
|
||||
return sts;
|
||||
}
|
||||
@@ -167,21 +170,18 @@ class CdmEngineMetricsImpl : public T {
|
||||
const CdmProvisioningResponse& response, std::string* cert,
|
||||
std::string* wrapped_key) override {
|
||||
CdmResponseType sts;
|
||||
M_TIME(
|
||||
sts = T::HandleProvisioningResponse(response, cert, wrapped_key),
|
||||
metrics_, cdm_engine_handle_provisioning_response_, sts);
|
||||
M_TIME(sts = T::HandleProvisioningResponse(response, cert, wrapped_key),
|
||||
metrics_, cdm_engine_handle_provisioning_response_, sts);
|
||||
return sts;
|
||||
}
|
||||
|
||||
|
||||
CdmResponseType Unprovision(CdmSecurityLevel security_level) override {
|
||||
CdmResponseType sts = T::Unprovision(security_level);
|
||||
metrics_->cdm_engine_unprovision_.Increment(sts, security_level);
|
||||
return sts;
|
||||
}
|
||||
|
||||
CdmResponseType GetUsageInfo(const std::string& app_id,
|
||||
int* error_detail,
|
||||
CdmResponseType GetUsageInfo(const std::string& app_id, int* error_detail,
|
||||
CdmUsageInfo* usage_info) override {
|
||||
CdmResponseType sts;
|
||||
int error_detail_alt;
|
||||
@@ -193,10 +193,8 @@ class CdmEngineMetricsImpl : public T {
|
||||
return sts;
|
||||
}
|
||||
|
||||
|
||||
CdmResponseType GetUsageInfo(const std::string& app_id,
|
||||
const CdmSecureStopId& ssid,
|
||||
int* error_detail,
|
||||
const CdmSecureStopId& ssid, int* error_detail,
|
||||
CdmUsageInfo* usage_info) override {
|
||||
CdmResponseType sts;
|
||||
int error_detail_alt;
|
||||
@@ -222,15 +220,15 @@ class CdmEngineMetricsImpl : public T {
|
||||
}
|
||||
|
||||
CdmResponseType RemoveUsageInfo(
|
||||
const std::string& app_id, const CdmSecureStopId& secure_stop_id)
|
||||
override {
|
||||
const std::string& app_id,
|
||||
const CdmSecureStopId& secure_stop_id) override {
|
||||
CdmResponseType sts = T::RemoveUsageInfo(app_id, secure_stop_id);
|
||||
metrics_->cdm_engine_remove_usage_info_.Increment(sts);
|
||||
return sts;
|
||||
}
|
||||
|
||||
CdmResponseType ReleaseUsageInfo(const CdmUsageInfoReleaseMessage& message)
|
||||
override {
|
||||
CdmResponseType ReleaseUsageInfo(
|
||||
const CdmUsageInfoReleaseMessage& message) override {
|
||||
CdmResponseType sts = T::ReleaseUsageInfo(message);
|
||||
metrics_->cdm_engine_release_usage_info_.Increment(sts);
|
||||
return sts;
|
||||
@@ -240,17 +238,15 @@ class CdmEngineMetricsImpl : public T {
|
||||
const std::string& app_id, CdmSecurityLevel security_level,
|
||||
std::vector<std::string>* ksids,
|
||||
std::vector<std::string>* provider_session_tokens) override {
|
||||
CdmResponseType sts = T::ListUsageIds(app_id, security_level,
|
||||
ksids, provider_session_tokens);
|
||||
CdmResponseType sts =
|
||||
T::ListUsageIds(app_id, security_level, ksids, provider_session_tokens);
|
||||
metrics_->cdm_engine_get_secure_stop_ids_.Increment(sts);
|
||||
return sts;
|
||||
}
|
||||
|
||||
|
||||
bool FindSessionForKey(const KeyId& key_id, CdmSessionId* session_id)
|
||||
override {
|
||||
bool status =
|
||||
T::FindSessionForKey(key_id, session_id);
|
||||
bool FindSessionForKey(const KeyId& key_id,
|
||||
CdmSessionId* session_id) override {
|
||||
bool status = T::FindSessionForKey(key_id, session_id);
|
||||
metrics_->cdm_engine_find_session_for_key_.Increment(status);
|
||||
return status;
|
||||
}
|
||||
@@ -258,8 +254,8 @@ class CdmEngineMetricsImpl : public T {
|
||||
CdmResponseType Decrypt(const CdmSessionId& session_id,
|
||||
const CdmDecryptionParameters& parameters) override {
|
||||
CdmResponseType sts;
|
||||
M_TIME(sts = T::Decrypt(session_id, parameters),
|
||||
metrics_, cdm_engine_decrypt_, sts,
|
||||
M_TIME(sts = T::Decrypt(session_id, parameters), metrics_,
|
||||
cdm_engine_decrypt_, sts,
|
||||
metrics::Pow2Bucket(parameters.encrypt_length));
|
||||
return sts;
|
||||
}
|
||||
@@ -269,5 +265,5 @@ class CdmEngineMetricsImpl : public T {
|
||||
Clock clock_;
|
||||
};
|
||||
|
||||
} // wvcdm namespace
|
||||
} // namespace wvcdm
|
||||
#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
|
||||
// code. The |error_detail| may be a CdmResponseType or other error code type.
|
||||
// It is only suitable for additional logging or debugging.
|
||||
virtual CdmResponseType RestoreOfflineSession(
|
||||
const CdmKeySetId& key_set_id, CdmLicenseType license_type,
|
||||
int* error_detail);
|
||||
virtual CdmResponseType RestoreOfflineSession(const CdmKeySetId& key_set_id,
|
||||
CdmLicenseType license_type,
|
||||
int* error_detail);
|
||||
// Restores an usage session from the provided |usage_data|.
|
||||
// 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
|
||||
// only suitable for additional logging or debugging.
|
||||
virtual CdmResponseType RestoreUsageSession(
|
||||
const DeviceFiles::CdmUsageData& usage_data,
|
||||
int* error_detail);
|
||||
const DeviceFiles::CdmUsageData& usage_data, int* error_detail);
|
||||
|
||||
virtual const CdmSessionId& session_id() { return session_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 has_provider_session_token() {
|
||||
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()
|
||||
{ return usage_support_type_; }
|
||||
virtual CdmUsageSupportType get_usage_support_type() {
|
||||
return usage_support_type_;
|
||||
}
|
||||
|
||||
// This method will remove keys by resetting crypto resources and
|
||||
// policy information. This renders the session mostly useless and it is
|
||||
@@ -218,8 +218,7 @@ class CdmSession {
|
||||
|
||||
CdmResponseType StoreLicense();
|
||||
|
||||
bool StoreLicense(DeviceFiles::LicenseState state,
|
||||
int* error_detail);
|
||||
bool StoreLicense(DeviceFiles::LicenseState state, int* error_detail);
|
||||
|
||||
bool UpdateUsageInfo();
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
typedef std::list<std::shared_ptr<CdmSession> > CdmSessionList;
|
||||
using CdmSessionList = std::list<std::shared_ptr<CdmSession> >;
|
||||
|
||||
// TODO(rfrias): Concurrency protection for this class has moved to CdmEngine.
|
||||
// Add it back when locks to control access to session usage and destruction
|
||||
@@ -43,8 +43,8 @@ class CdmSessionMap {
|
||||
void GetSessionList(CdmSessionList& sessions);
|
||||
|
||||
private:
|
||||
typedef std::map<CdmSessionId, std::shared_ptr<CdmSession> >
|
||||
CdmIdToSessionMap;
|
||||
using CdmIdToSessionMap =
|
||||
std::map<CdmSessionId, std::shared_ptr<CdmSession> >;
|
||||
|
||||
bool FindSessionNoLock(const CdmSessionId& session_id,
|
||||
std::shared_ptr<CdmSession>* session);
|
||||
|
||||
@@ -25,21 +25,23 @@ class ServiceCertificate;
|
||||
|
||||
class CertificateProvisioning {
|
||||
public:
|
||||
CertificateProvisioning(metrics::CryptoMetrics* metrics) :
|
||||
crypto_session_(CryptoSession::MakeCryptoSession(metrics)),
|
||||
cert_type_(kCertificateWidevine),
|
||||
service_certificate_(new ServiceCertificate()) {}
|
||||
CertificateProvisioning(metrics::CryptoMetrics* metrics)
|
||||
: crypto_session_(CryptoSession::MakeCryptoSession(metrics)),
|
||||
cert_type_(kCertificateWidevine),
|
||||
service_certificate_(new ServiceCertificate()) {}
|
||||
~CertificateProvisioning() {}
|
||||
|
||||
CdmResponseType Init(const std::string& service_certificate);
|
||||
|
||||
// Construct a valid provisioning request.
|
||||
// The request will be sent to the provisioning server.
|
||||
CdmResponseType GetProvisioningRequest(
|
||||
SecurityLevel requested_security_level, CdmCertificateType cert_type,
|
||||
const std::string& cert_authority, const std::string& origin,
|
||||
const std::string& spoid, CdmProvisioningRequest* request,
|
||||
std::string* default_url);
|
||||
CdmResponseType GetProvisioningRequest(SecurityLevel requested_security_level,
|
||||
CdmCertificateType cert_type,
|
||||
const std::string& cert_authority,
|
||||
const std::string& origin,
|
||||
const std::string& spoid,
|
||||
CdmProvisioningRequest* request,
|
||||
std::string* default_url);
|
||||
|
||||
// Process the provisioning response.
|
||||
CdmResponseType HandleProvisioningResponse(
|
||||
@@ -48,12 +50,11 @@ class CertificateProvisioning {
|
||||
|
||||
private:
|
||||
CdmResponseType SetSpoidParameter(
|
||||
const std::string& origin,
|
||||
const std::string& spoid,
|
||||
const std::string& origin, const std::string& spoid,
|
||||
video_widevine::ProvisioningRequest* request);
|
||||
|
||||
video_widevine::SignedProvisioningMessage::ProtocolVersion
|
||||
GetProtocolVersion();
|
||||
GetProtocolVersion();
|
||||
|
||||
std::unique_ptr<CryptoSession> crypto_session_;
|
||||
CdmCertificateType cert_type_;
|
||||
|
||||
@@ -11,15 +11,15 @@ namespace wvcdm {
|
||||
|
||||
class CryptoKey {
|
||||
public:
|
||||
CryptoKey() {};
|
||||
~CryptoKey() {};
|
||||
CryptoKey(){};
|
||||
~CryptoKey(){};
|
||||
|
||||
const std::string& key_id() const { return key_id_; }
|
||||
const std::string& key_data() const { return key_data_; }
|
||||
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_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_; }
|
||||
CdmCipherMode cipher_mode() const { return cipher_mode_; }
|
||||
void set_key_id(const std::string& key_id) { key_id_ = key_id; }
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace wvcdm {
|
||||
class CryptoKey;
|
||||
class UsageTableHeader;
|
||||
|
||||
typedef std::map<std::string, CryptoKey*> CryptoKeyMap;
|
||||
using CryptoKeyMap = std::map<std::string, CryptoKey*>;
|
||||
|
||||
// Crypto session utility functions used by KeySession implementations.
|
||||
void GenerateMacContext(const std::string& input_context,
|
||||
@@ -43,7 +43,7 @@ class CryptoSessionFactory;
|
||||
|
||||
class CryptoSession {
|
||||
public:
|
||||
typedef OEMCrypto_HDCP_Capability HdcpCapability;
|
||||
using HdcpCapability = OEMCrypto_HDCP_Capability;
|
||||
typedef enum {
|
||||
kUsageDurationsInvalid = 0,
|
||||
kUsageDurationPlaybackNotBegun = 1,
|
||||
@@ -96,32 +96,31 @@ class CryptoSession {
|
||||
std::string* signature);
|
||||
virtual CdmResponseType PrepareRenewalRequest(const std::string& message,
|
||||
std::string* signature);
|
||||
virtual CdmResponseType LoadKeys(
|
||||
const std::string& message, const std::string& signature,
|
||||
const std::string& mac_key_iv, const std::string& mac_key,
|
||||
const std::vector<CryptoKey>& key_array,
|
||||
const std::string& provider_session_token,
|
||||
const std::string& srm_requirement,
|
||||
CdmLicenseKeyType key_type);
|
||||
virtual CdmResponseType LoadKeys(const std::string& message,
|
||||
const std::string& signature,
|
||||
const std::string& mac_key_iv,
|
||||
const std::string& mac_key,
|
||||
const std::vector<CryptoKey>& key_array,
|
||||
const std::string& provider_session_token,
|
||||
const std::string& srm_requirement,
|
||||
CdmLicenseKeyType key_type);
|
||||
virtual CdmResponseType LoadEntitledContentKeys(
|
||||
const std::vector<CryptoKey>& key_array);
|
||||
virtual CdmResponseType LoadCertificatePrivateKey(std::string& wrapped_key);
|
||||
virtual CdmResponseType RefreshKeys(const std::string& message,
|
||||
const std::string& signature,
|
||||
int num_keys,
|
||||
const CryptoKey* key_array);
|
||||
int num_keys, const CryptoKey* key_array);
|
||||
virtual CdmResponseType GenerateNonce(uint32_t* nonce);
|
||||
virtual CdmResponseType GenerateDerivedKeys(const std::string& message);
|
||||
virtual CdmResponseType GenerateDerivedKeys(const std::string& message,
|
||||
const std::string& session_key);
|
||||
virtual CdmResponseType RewrapCertificate(
|
||||
const std::string& signed_message,
|
||||
const std::string& signature,
|
||||
const std::string& nonce,
|
||||
const std::string& private_key,
|
||||
const std::string& iv,
|
||||
const std::string& wrapping_key,
|
||||
std::string* wrapped_private_key);
|
||||
virtual CdmResponseType RewrapCertificate(const std::string& signed_message,
|
||||
const std::string& signature,
|
||||
const std::string& nonce,
|
||||
const std::string& private_key,
|
||||
const std::string& iv,
|
||||
const std::string& wrapping_key,
|
||||
std::string* wrapped_private_key);
|
||||
|
||||
// Media data path
|
||||
virtual CdmResponseType Decrypt(const CdmDecryptionParameters& params);
|
||||
@@ -177,6 +176,7 @@ class CryptoSession {
|
||||
|
||||
virtual bool GetBuildInformation(SecurityLevel security_level,
|
||||
std::string* info);
|
||||
virtual bool GetBuildInformation(std::string* info);
|
||||
|
||||
virtual uint32_t IsDecryptHashSupported(SecurityLevel security_level);
|
||||
|
||||
@@ -236,8 +236,7 @@ class CryptoSession {
|
||||
virtual metrics::CryptoMetrics* GetCryptoMetrics() { return metrics_; }
|
||||
|
||||
virtual CdmResponseType GetProvisioningMethod(
|
||||
SecurityLevel requested_security_level,
|
||||
CdmClientTokenType* token_type);
|
||||
SecurityLevel requested_security_level, CdmClientTokenType* token_type);
|
||||
|
||||
protected:
|
||||
// Creates an instance of CryptoSession with the given |crypto_metrics|.
|
||||
@@ -268,8 +267,8 @@ class CryptoSession {
|
||||
static bool ExtractSystemIdFromOemCert(const std::string& oem_cert,
|
||||
uint32_t* system_id);
|
||||
CdmResponseType GetSystemIdInternal(uint32_t* system_id);
|
||||
CdmResponseType GenerateSignature(
|
||||
const std::string& message, std::string* signature);
|
||||
CdmResponseType GenerateSignature(const std::string& message,
|
||||
std::string* signature);
|
||||
CdmResponseType GenerateRsaSignature(const std::string& message,
|
||||
std::string* signature);
|
||||
|
||||
|
||||
@@ -79,21 +79,17 @@ class DeviceFiles {
|
||||
virtual bool HasCertificate();
|
||||
virtual bool RemoveCertificate();
|
||||
|
||||
virtual bool StoreLicense(const std::string& key_set_id,
|
||||
const LicenseState state,
|
||||
const CdmInitData& pssh_data,
|
||||
const CdmKeyMessage& key_request,
|
||||
const CdmKeyResponse& key_response,
|
||||
const CdmKeyMessage& key_renewal_request,
|
||||
const CdmKeyResponse& key_renewal_response,
|
||||
const std::string& release_server_url,
|
||||
int64_t playback_start_time,
|
||||
int64_t last_playback_time,
|
||||
int64_t grace_period_end_time,
|
||||
const CdmAppParameterMap& app_parameters,
|
||||
const CdmUsageEntry& usage_entry,
|
||||
uint32_t usage_entry_number,
|
||||
ResponseType* result);
|
||||
virtual bool StoreLicense(
|
||||
const std::string& key_set_id, const LicenseState state,
|
||||
const CdmInitData& pssh_data, const CdmKeyMessage& key_request,
|
||||
const CdmKeyResponse& key_response,
|
||||
const CdmKeyMessage& key_renewal_request,
|
||||
const CdmKeyResponse& key_renewal_response,
|
||||
const std::string& release_server_url, int64_t playback_start_time,
|
||||
int64_t last_playback_time, int64_t grace_period_end_time,
|
||||
const CdmAppParameterMap& app_parameters,
|
||||
const CdmUsageEntry& usage_entry, uint32_t usage_entry_number,
|
||||
ResponseType* result);
|
||||
|
||||
virtual bool RetrieveLicense(
|
||||
const std::string& key_set_id, LicenseState* state,
|
||||
@@ -135,10 +131,9 @@ class DeviceFiles {
|
||||
// Retrieve usage identifying information stored on the file system.
|
||||
// The caller needs to specify at least one of |ksids| or
|
||||
// |provider_session_tokens|
|
||||
virtual bool ListUsageIds(
|
||||
const std::string& app_id,
|
||||
std::vector<std::string>* ksids,
|
||||
std::vector<std::string>* provider_session_tokens);
|
||||
virtual bool ListUsageIds(const std::string& app_id,
|
||||
std::vector<std::string>* ksids,
|
||||
std::vector<std::string>* provider_session_tokens);
|
||||
|
||||
// Get the provider session token for the given key_set_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|.
|
||||
// Returns false if the entry could not be found.
|
||||
virtual bool RetrieveUsageInfoByKeySetId(
|
||||
const std::string& usage_info_file_name,
|
||||
const std::string& key_set_id,
|
||||
std::string* provider_session_token,
|
||||
CdmKeyMessage* license_request,
|
||||
CdmKeyResponse* license_response,
|
||||
CdmUsageEntry* usage_entry,
|
||||
const std::string& usage_info_file_name, const std::string& key_set_id,
|
||||
std::string* provider_session_token, CdmKeyMessage* license_request,
|
||||
CdmKeyResponse* license_response, CdmUsageEntry* usage_entry,
|
||||
uint32_t* usage_entry_number);
|
||||
|
||||
// These APIs support upgrading from usage tables to usage tabler header +
|
||||
@@ -218,8 +210,7 @@ class DeviceFiles {
|
||||
private:
|
||||
// Extract serial number and system ID from DRM Device certificate
|
||||
bool ExtractDeviceInfo(const std::string& device_certificate,
|
||||
std::string* serial_number,
|
||||
uint32_t* system_id);
|
||||
std::string* serial_number, uint32_t* system_id);
|
||||
|
||||
// Helpers that wrap the File interface and automatically handle hashing, as
|
||||
// well as adding the device files base path to to the file name.
|
||||
|
||||
@@ -34,16 +34,15 @@ class InitializationData {
|
||||
CdmHlsMethod hls_method() const { return hls_method_; }
|
||||
std::vector<video_widevine::WidevinePsshData_EntitledKey> ExtractWrappedKeys()
|
||||
const;
|
||||
bool contains_entitled_keys() const { return contains_entitled_keys_; }
|
||||
|
||||
private:
|
||||
bool SelectWidevinePssh(const CdmInitData& init_data,
|
||||
bool prefer_entitlements,
|
||||
CdmInitData* output);
|
||||
bool prefer_entitlements, CdmInitData* output);
|
||||
// Helpers used by SelectWidevinePssh().
|
||||
bool ExtractWidevinePsshs(const CdmInitData& init_data,
|
||||
std::vector<CdmInitData>* psshs);
|
||||
bool ExtractWidevinePsshData(const uint8_t* data,
|
||||
size_t length,
|
||||
bool ExtractWidevinePsshData(const uint8_t* data, size_t length,
|
||||
CdmInitData* output);
|
||||
|
||||
bool ExtractHlsAttributes(const std::string& attribute_list,
|
||||
@@ -86,6 +85,7 @@ class InitializationData {
|
||||
bool is_hls_;
|
||||
bool is_webm_;
|
||||
bool is_audio_;
|
||||
bool contains_entitled_keys_;
|
||||
|
||||
std::vector<uint8_t> hls_iv_;
|
||||
CdmHlsMethod hls_method_;
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "metrics_collections.h"
|
||||
#include "OEMCryptoCENC.h"
|
||||
#include "metrics_collections.h"
|
||||
#include "wv_cdm_types.h"
|
||||
|
||||
namespace wvcdm {
|
||||
@@ -25,8 +25,7 @@ class KeySession {
|
||||
virtual KeySessionType Type() = 0;
|
||||
virtual OEMCryptoResult GenerateDerivedKeys(const std::string& message) = 0;
|
||||
virtual OEMCryptoResult GenerateDerivedKeys(
|
||||
const std::string& message,
|
||||
const std::string& session_key) = 0;
|
||||
const std::string& message, const std::string& session_key) = 0;
|
||||
virtual OEMCryptoResult LoadKeys(const std::string& message,
|
||||
const std::string& signature,
|
||||
const std::string& mac_key_iv,
|
||||
|
||||
@@ -21,7 +21,8 @@ using video_widevine::WidevinePsshData_EntitledKey;
|
||||
// Holds all content and operator session keys for a session.
|
||||
class LicenseKeys {
|
||||
public:
|
||||
LicenseKeys() {}
|
||||
LicenseKeys(CdmSecurityLevel security_level)
|
||||
: security_level_(security_level) {}
|
||||
virtual ~LicenseKeys() { Clear(); }
|
||||
|
||||
virtual bool Empty() { return key_statuses_.empty(); }
|
||||
@@ -54,6 +55,9 @@ class LicenseKeys {
|
||||
// to the key, returns true.
|
||||
virtual bool MeetsConstraints(const KeyId& key_id);
|
||||
|
||||
// Indicates whether specified key can be used for the sessions security level
|
||||
virtual bool MeetsSecurityLevelConstraints(const KeyId& key_id);
|
||||
|
||||
// Applies a resolution and/or hdcp change to each key, updating their
|
||||
// useability under their constraints.
|
||||
virtual void ApplyConstraints(uint32_t new_resolution,
|
||||
@@ -67,10 +71,15 @@ class LicenseKeys {
|
||||
virtual void SetEntitledKeys(
|
||||
const std::vector<WidevinePsshData_EntitledKey>& keys);
|
||||
|
||||
// For test use: Sets the OEMCrypto security level
|
||||
virtual void SetSecurityLevelForTest(CdmSecurityLevel security_level) {
|
||||
security_level_ = security_level;
|
||||
}
|
||||
|
||||
private:
|
||||
typedef ::video_widevine::License::KeyContainer KeyContainer;
|
||||
typedef std::map<wvcdm::KeyId, LicenseKeyStatus*>::const_iterator
|
||||
LicenseKeyStatusIterator;
|
||||
using KeyContainer = ::video_widevine::License::KeyContainer;
|
||||
using LicenseKeyStatusIterator =
|
||||
std::map<wvcdm::KeyId, LicenseKeyStatus*>::const_iterator;
|
||||
|
||||
void Clear();
|
||||
|
||||
@@ -83,6 +92,8 @@ class LicenseKeys {
|
||||
// key status from |key_statuses_| when using entitlement key licensing.
|
||||
std::map<KeyId, KeyId> content_keyid_to_entitlement_key_id_;
|
||||
|
||||
CdmSecurityLevel security_level_;
|
||||
|
||||
CORE_DISALLOW_COPY_AND_ASSIGN(LicenseKeys);
|
||||
};
|
||||
|
||||
@@ -114,25 +125,30 @@ class LicenseKeyStatus {
|
||||
// Note: this will return true until the first call to ApplyConstraints().
|
||||
virtual bool MeetsConstraints() const { return meets_constraints_; }
|
||||
|
||||
// Indicates whether a key can be used for a given security level
|
||||
virtual bool MeetsSecurityLevelConstraints() const {
|
||||
return meets_security_level_constraints_;
|
||||
}
|
||||
|
||||
// Applies the given changes in resolution or HDCP settings.
|
||||
virtual void ApplyConstraints(uint32_t new_resolution,
|
||||
CryptoSession::HdcpCapability new_hdcp_level);
|
||||
|
||||
protected:
|
||||
typedef ::video_widevine::License::KeyContainer KeyContainer;
|
||||
typedef KeyContainer::OperatorSessionKeyPermissions
|
||||
OperatorSessionKeyPermissions;
|
||||
typedef KeyContainer::OutputProtection OutputProtection;
|
||||
typedef KeyContainer::VideoResolutionConstraint VideoResolutionConstraint;
|
||||
typedef ::google::protobuf::RepeatedPtrField<VideoResolutionConstraint>
|
||||
ConstraintList;
|
||||
using KeyContainer = ::video_widevine::License::KeyContainer;
|
||||
using OperatorSessionKeyPermissions =
|
||||
KeyContainer::OperatorSessionKeyPermissions;
|
||||
using OutputProtection = KeyContainer::OutputProtection;
|
||||
using VideoResolutionConstraint = KeyContainer::VideoResolutionConstraint;
|
||||
using ConstraintList =
|
||||
::google::protobuf::RepeatedPtrField<VideoResolutionConstraint>;
|
||||
|
||||
LicenseKeyStatus(const KeyContainer& key);
|
||||
LicenseKeyStatus(const KeyContainer& key, const CdmSecurityLevel level);
|
||||
|
||||
virtual ~LicenseKeyStatus() {}
|
||||
|
||||
private:
|
||||
void ParseContentKey(const KeyContainer& key);
|
||||
void ParseContentKey(const KeyContainer& key, CdmSecurityLevel level);
|
||||
void ParseOperatorSessionKey(const KeyContainer& key);
|
||||
|
||||
bool HasConstraints() { return is_content_key_ && constraints_.size() != 0; }
|
||||
@@ -142,6 +158,7 @@ class LicenseKeyStatus {
|
||||
bool is_content_key_;
|
||||
CdmKeyStatus key_status_;
|
||||
bool meets_constraints_;
|
||||
bool meets_security_level_constraints_;
|
||||
CdmKeyAllowedUsage allowed_usage_;
|
||||
CryptoSession::HdcpCapability default_hdcp_level_;
|
||||
ConstraintList constraints_;
|
||||
|
||||
@@ -47,11 +47,11 @@ OEMCryptoResult OEMCrypto_ShrinkUsageTableHeader(SecurityLevel level,
|
||||
uint32_t new_table_size,
|
||||
uint8_t* header_buffer,
|
||||
size_t* header_buffer_length);
|
||||
OEMCryptoResult OEMCrypto_CreateOldUsageEntry(SecurityLevel level,
|
||||
uint64_t time_since_license_received, uint64_t time_since_first_decrypt,
|
||||
uint64_t time_since_last_decrypt, OEMCrypto_Usage_Entry_Status status,
|
||||
uint8_t* server_mac_key, uint8_t* client_mac_key, const uint8_t* pst,
|
||||
size_t pst_length);
|
||||
OEMCryptoResult OEMCrypto_CreateOldUsageEntry(
|
||||
SecurityLevel level, uint64_t time_since_license_received,
|
||||
uint64_t time_since_first_decrypt, uint64_t time_since_last_decrypt,
|
||||
OEMCrypto_Usage_Entry_Status status, uint8_t* server_mac_key,
|
||||
uint8_t* client_mac_key, const uint8_t* pst, size_t pst_length);
|
||||
uint32_t OEMCrypto_GetAnalogOutputFlags(SecurityLevel level);
|
||||
const char* OEMCrypto_BuildInformation(SecurityLevel level);
|
||||
uint32_t OEMCrypto_ResourceRatingTier(SecurityLevel level);
|
||||
@@ -107,7 +107,7 @@ OEMCryptoResult OEMCrypto_LoadKeys_Back_Compat(
|
||||
OEMCryptoResult OEMCrypto_UpdateUsageTable();
|
||||
|
||||
OEMCryptoResult OEMCrypto_DeactivateUsageEntry_V12(const uint8_t* pst,
|
||||
size_t pst_length);
|
||||
size_t pst_length);
|
||||
OEMCryptoResult OEMCrypto_DeleteUsageEntry(
|
||||
OEMCrypto_SESSION session, const uint8_t* pst, size_t pst_length,
|
||||
const uint8_t* message, size_t message_length, const uint8_t* signature,
|
||||
|
||||
@@ -45,8 +45,7 @@ class PolicyEngine {
|
||||
|
||||
// Verifies whether the policy allows use of the specified key of
|
||||
// a given security level for content decryption.
|
||||
virtual bool CanUseKeyForSecurityLevel(const KeyId& key_id,
|
||||
CdmSecurityLevel security_level);
|
||||
virtual bool CanUseKeyForSecurityLevel(const KeyId& key_id);
|
||||
|
||||
// OnTimerEvent is called when a timer fires. It notifies the Policy Engine
|
||||
// that the timer has fired and dispatches the relevant events through
|
||||
@@ -167,10 +166,12 @@ class PolicyEngine {
|
||||
// Guard against clock rollbacks
|
||||
int64_t GetCurrentTime();
|
||||
|
||||
// set_clock() is for testing only. It alters ownership of the
|
||||
// passed-in pointer.
|
||||
// Test only methods
|
||||
// set_clock alters ownership of the passed-in pointer.
|
||||
void set_clock(Clock* clock);
|
||||
|
||||
void SetSecurityLevelForTest(CdmSecurityLevel security_level);
|
||||
|
||||
LicenseState license_state_;
|
||||
|
||||
// This is the current policy information for this license. This gets updated
|
||||
|
||||
@@ -68,7 +68,6 @@ class RsaPublicKey {
|
||||
CORE_DISALLOW_COPY_AND_ASSIGN(RsaPublicKey);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Extracts an integer value from the extensions in a certificate.
|
||||
* @param cert A PKCS7 encoded X.509 certificate chain.
|
||||
|
||||
@@ -20,8 +20,7 @@
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
typedef std::map<CdmSessionId, CdmClientPropertySet*>
|
||||
CdmClientPropertySetMap;
|
||||
using CdmClientPropertySetMap = std::map<CdmSessionId, CdmClientPropertySet*>;
|
||||
|
||||
// This class saves information about features and properties enabled
|
||||
// for a given platform. At initialization it initializes properties from
|
||||
@@ -53,6 +52,9 @@ class Properties {
|
||||
static inline bool allow_service_certificate_requests() {
|
||||
return allow_service_certificate_requests_;
|
||||
}
|
||||
static inline bool device_files_is_a_real_filesystem() {
|
||||
return device_files_is_a_real_filesystem_;
|
||||
}
|
||||
static void set_provisioning_messages_are_binary(bool flag) {
|
||||
provisioning_messages_are_binary_ = flag;
|
||||
}
|
||||
@@ -63,11 +65,14 @@ class Properties {
|
||||
static bool GetProductName(std::string* product_name);
|
||||
static bool GetBuildInfo(std::string* build_info);
|
||||
static bool GetWVCdmVersion(std::string* version);
|
||||
// Gets the base path for the device non-secure storage. Note that, depending
|
||||
// on the value of device_files_is_a_real_filesystem, this may or may not be
|
||||
// a real filesystem path.
|
||||
static bool GetDeviceFilesBasePath(CdmSecurityLevel security_level,
|
||||
std::string* base_path);
|
||||
static bool GetFactoryKeyboxPath(std::string* keybox);
|
||||
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 UseProviderIdInProvisioningRequest();
|
||||
|
||||
@@ -137,6 +142,7 @@ class Properties {
|
||||
static bool use_certificates_as_identification_;
|
||||
static bool provisioning_messages_are_binary_;
|
||||
static bool allow_service_certificate_requests_;
|
||||
static bool device_files_is_a_real_filesystem_;
|
||||
static std::unique_ptr<CdmClientPropertySetMap> session_property_set_;
|
||||
|
||||
CORE_DISALLOW_COPY_AND_ASSIGN(Properties);
|
||||
|
||||
@@ -56,8 +56,8 @@ class ServiceCertificate {
|
||||
static bool GetRequest(CdmKeyMessage* request);
|
||||
static CdmResponseType ParseResponse(const std::string& response,
|
||||
std::string* signed_certificate);
|
||||
private:
|
||||
|
||||
private:
|
||||
// Encrypt data using RSA with OAEP padding.
|
||||
// |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.
|
||||
|
||||
@@ -59,8 +59,8 @@ class UsageTableHeader {
|
||||
const std::string& usage_info_filename,
|
||||
uint32_t* usage_entry_number);
|
||||
virtual CdmResponseType LoadEntry(CryptoSession* crypto_session,
|
||||
const CdmUsageEntry& usage_entry,
|
||||
uint32_t usage_entry_number);
|
||||
const CdmUsageEntry& usage_entry,
|
||||
uint32_t usage_entry_number);
|
||||
virtual CdmResponseType UpdateEntry(CryptoSession* crypto_session,
|
||||
CdmUsageEntry* usage_entry);
|
||||
|
||||
|
||||
@@ -39,36 +39,34 @@ static const char KEY_SET_ID_PREFIX[] = "ksid";
|
||||
static const char KEY_SYSTEM[] = "com.widevine";
|
||||
|
||||
// define query keys, values here
|
||||
static const std::string QUERY_KEY_LICENSE_TYPE = "LicenseType";
|
||||
// "Streaming", "Offline"
|
||||
static const std::string QUERY_KEY_PLAY_ALLOWED = "PlayAllowed";
|
||||
// "True", "False"
|
||||
static const std::string QUERY_KEY_PERSIST_ALLOWED = "PersistAllowed";
|
||||
// "True", "False"
|
||||
static const std::string QUERY_KEY_RENEW_ALLOWED = "RenewAllowed";
|
||||
// "True", "False"
|
||||
static const std::string QUERY_KEY_LICENSE_TYPE =
|
||||
"LicenseType"; // "Streaming", "Offline"
|
||||
static const std::string QUERY_KEY_PLAY_ALLOWED =
|
||||
"PlayAllowed"; // "True", "False"
|
||||
static const std::string QUERY_KEY_PERSIST_ALLOWED =
|
||||
"PersistAllowed"; // "True", "False"
|
||||
static const std::string QUERY_KEY_RENEW_ALLOWED =
|
||||
"RenewAllowed"; // "True", "False"
|
||||
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 =
|
||||
"PlaybackDurationRemaining"; // non-negative integer denoting seconds
|
||||
static const std::string QUERY_KEY_RENEWAL_SERVER_URL = "RenewalServerUrl";
|
||||
// url
|
||||
static const std::string QUERY_KEY_OEMCRYPTO_SESSION_ID = "OemCryptoSessionId";
|
||||
// session id
|
||||
static const std::string QUERY_KEY_SECURITY_LEVEL = "SecurityLevel";
|
||||
// "L1", "L3"
|
||||
static const std::string QUERY_KEY_DEVICE_ID = "DeviceID";
|
||||
// device unique id
|
||||
static const std::string QUERY_KEY_SYSTEM_ID = "SystemID";
|
||||
// system id
|
||||
static const std::string QUERY_KEY_PROVISIONING_ID = "ProvisioningID";
|
||||
// provisioning unique id
|
||||
static const std::string QUERY_KEY_CURRENT_HDCP_LEVEL = "HdcpLevel";
|
||||
// current HDCP level
|
||||
static const std::string QUERY_KEY_MAX_HDCP_LEVEL = "MaxHdcpLevel";
|
||||
// maximum supported HDCP level
|
||||
static const std::string QUERY_KEY_USAGE_SUPPORT = "UsageSupport";
|
||||
// whether usage reporting is supported
|
||||
"PlaybackDurationRemaining"; // non-negative integer denoting seconds
|
||||
static const std::string QUERY_KEY_RENEWAL_SERVER_URL =
|
||||
"RenewalServerUrl"; // url
|
||||
static const std::string QUERY_KEY_OEMCRYPTO_SESSION_ID =
|
||||
"OemCryptoSessionId"; // session id
|
||||
static const std::string QUERY_KEY_SECURITY_LEVEL =
|
||||
"SecurityLevel"; // "L1", "L3"
|
||||
static const std::string QUERY_KEY_DEVICE_ID = "DeviceID"; // device unique id
|
||||
static const std::string QUERY_KEY_SYSTEM_ID = "SystemID"; // system id
|
||||
static const std::string QUERY_KEY_PROVISIONING_ID =
|
||||
"ProvisioningID"; // provisioning unique id
|
||||
static const std::string QUERY_KEY_CURRENT_HDCP_LEVEL =
|
||||
"HdcpLevel"; // current HDCP level
|
||||
static const std::string QUERY_KEY_MAX_HDCP_LEVEL =
|
||||
"MaxHdcpLevel"; // maximum supported HDCP level
|
||||
static const std::string QUERY_KEY_USAGE_SUPPORT =
|
||||
"UsageSupport"; // whether usage reporting is supported
|
||||
static const std::string QUERY_KEY_NUMBER_OF_OPEN_SESSIONS =
|
||||
"NumberOfOpenSessions";
|
||||
static const std::string QUERY_KEY_MAX_NUMBER_OF_SESSIONS =
|
||||
@@ -76,14 +74,14 @@ static const std::string QUERY_KEY_MAX_NUMBER_OF_SESSIONS =
|
||||
static const std::string QUERY_KEY_OEMCRYPTO_API_VERSION =
|
||||
"OemCryptoApiVersion";
|
||||
static const std::string QUERY_KEY_CURRENT_SRM_VERSION = "CurrentSRMVersion";
|
||||
static const std::string QUERY_KEY_SRM_UPDATE_SUPPORT = "SRMUpdateSupport";
|
||||
// whether OEM supports SRM update
|
||||
static const std::string QUERY_KEY_SRM_UPDATE_SUPPORT =
|
||||
"SRMUpdateSupport"; // whether OEM supports SRM update
|
||||
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_OEMCRYPTO_BUILD_INFORMATION =
|
||||
"OemCryptoBuildInformation";
|
||||
static const std::string QUERY_KEY_DECRYPT_HASH_SUPPORT =
|
||||
"DecryptHashSupport";
|
||||
static const std::string QUERY_KEY_DECRYPT_HASH_SUPPORT = "DecryptHashSupport";
|
||||
static const std::string QUERY_KEY_PROVISIONING_MODEL = "ProvisioningModel";
|
||||
|
||||
static const std::string QUERY_VALUE_TRUE = "True";
|
||||
static const std::string QUERY_VALUE_FALSE = "False";
|
||||
@@ -103,6 +101,9 @@ static const std::string QUERY_VALUE_HDCP_V2_1 = "HDCP-2.1";
|
||||
static const std::string QUERY_VALUE_HDCP_V2_2 = "HDCP-2.2";
|
||||
static const std::string QUERY_VALUE_HDCP_V2_3 = "HDCP-2.3";
|
||||
static const std::string QUERY_VALUE_HDCP_LEVEL_UNKNOWN = "HDCP-LevelUnknown";
|
||||
static const std::string QUERY_VALUE_DRM_CERTIFICATE = "DrmCertificate";
|
||||
static const std::string QUERY_VALUE_KEYBOX = "Keybox";
|
||||
static const std::string QUERY_VALUE_OEM_CERTIFICATE = "OEMCertificate";
|
||||
|
||||
static const std::string ISO_BMFF_VIDEO_MIME_TYPE = "video/mp4";
|
||||
static const std::string ISO_BMFF_AUDIO_MIME_TYPE = "audio/mp4";
|
||||
@@ -125,7 +126,7 @@ static const std::string HLS_URI_ATTRIBUTE = "URI";
|
||||
static const char EMPTY_ORIGIN[] = "";
|
||||
static const char EMPTY_SPOID[] = "";
|
||||
|
||||
//Policy engine HDCP enforcement
|
||||
// Policy engine HDCP enforcement
|
||||
static const uint32_t HDCP_UNSPECIFIED_VIDEO_RESOLUTION = 0;
|
||||
static const int64_t HDCP_DEVICE_CHECK_INTERVAL = 10;
|
||||
static const char EMPTY_APP_PACKAGE_NAME[] = "";
|
||||
|
||||
@@ -5,39 +5,42 @@
|
||||
#ifndef WVCDM_CORE_WV_CDM_TYPES_H_
|
||||
#define WVCDM_CORE_WV_CDM_TYPES_H_
|
||||
|
||||
#include <array>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <array>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
typedef std::string CdmKeySystem;
|
||||
typedef std::string CdmInitData;
|
||||
typedef std::string CdmKeyMessage;
|
||||
typedef std::string CdmKeyResponse;
|
||||
typedef std::string KeyId;
|
||||
typedef std::string CdmSecureStopId;
|
||||
typedef std::string CdmSessionId;
|
||||
typedef std::string CdmKeySetId;
|
||||
typedef std::string RequestId;
|
||||
typedef uint32_t CryptoResult;
|
||||
typedef uint32_t CryptoSessionId;
|
||||
typedef std::map<std::string, std::string> CdmAppParameterMap;
|
||||
typedef std::map<std::string, std::string> CdmQueryMap;
|
||||
typedef std::vector<std::string> CdmUsageInfo;
|
||||
typedef std::string CdmUsageInfoReleaseMessage;
|
||||
typedef std::string CdmProvisioningRequest;
|
||||
typedef std::string CdmProvisioningResponse;
|
||||
typedef std::string CdmUsageTableHeader;
|
||||
typedef std::string CdmUsageEntry;
|
||||
using CdmKeySystem = std::string;
|
||||
using CdmInitData = std::string;
|
||||
using CdmKeyMessage = std::string;
|
||||
using CdmKeyResponse = std::string;
|
||||
using KeyId = std::string;
|
||||
using CdmSecureStopId = std::string;
|
||||
using CdmSessionId = std::string;
|
||||
using CdmKeySetId = std::string;
|
||||
using RequestId = std::string;
|
||||
using CryptoResult = uint32_t;
|
||||
using CryptoSessionId = uint32_t;
|
||||
using CdmAppParameterMap = std::map<std::string, std::string>;
|
||||
using CdmQueryMap = std::map<std::string, std::string>;
|
||||
using CdmUsageInfo = std::vector<std::string>;
|
||||
using CdmUsageInfoReleaseMessage = std::string;
|
||||
using CdmProvisioningRequest = std::string;
|
||||
using CdmProvisioningResponse = std::string;
|
||||
using CdmUsageTableHeader = std::string;
|
||||
using CdmUsageEntry = std::string;
|
||||
|
||||
enum CdmKeyRequestType {
|
||||
kKeyRequestTypeUnknown,
|
||||
kKeyRequestTypeInitial,
|
||||
kKeyRequestTypeRenewal,
|
||||
kKeyRequestTypeRelease,
|
||||
kKeyRequestTypeNone, // Keys are loaded and no license request is necessary
|
||||
kKeyRequestTypeUpdate,
|
||||
};
|
||||
|
||||
enum CdmOfflineLicenseState {
|
||||
@@ -395,6 +398,7 @@ enum CdmResponseType {
|
||||
REWRAP_DEVICE_RSA_KEY_ERROR = 344,
|
||||
REWRAP_DEVICE_RSA_KEY_30_ERROR = 345,
|
||||
INVALID_SRM_LIST = 346,
|
||||
KEYSET_ID_NOT_FOUND_4 = 347,
|
||||
// Don't forget to add new values to ../test/test_printers.cpp.
|
||||
};
|
||||
|
||||
@@ -405,8 +409,9 @@ enum CdmKeyStatus {
|
||||
kKeyStatusOutputNotAllowed,
|
||||
kKeyStatusPending,
|
||||
kKeyStatusInternalError,
|
||||
kKeyStatusUsableInFuture,
|
||||
};
|
||||
typedef std::map<KeyId, CdmKeyStatus> CdmKeyStatusMap;
|
||||
using CdmKeyStatusMap = std::map<KeyId, CdmKeyStatus>;
|
||||
|
||||
enum CdmLicenseType {
|
||||
kLicenseTypeOffline,
|
||||
|
||||
Reference in New Issue
Block a user