CAS Proxy SDK git checkin as per g3doc.

Adds support for specifying service type when creating a service certificate.

A recent change to the SDK allows for service certificates (DrmCertificate) to also specify a ServiceType indicating which type of service they are supposed to be used on.  This CL adds certificate creation service support for this.

-------------
Fix typo in cas proxy SDK.

-------------
Migrate C++ proto_library rules to cc_proto_library.

We update dependency edges of cc_* rules on proto_library() rules to use a cc_proto_library() intermediary in preparation for eliminating proto_library()'s cc support as per []

More information: []

Tested:
    TAP --sample for global presubmit queue
    []

-------------
Migrate cc proto_library to cc_proto_library. Also fixes build break introduced by []

-------------
Remove unnecessary #MOE directives

-------------
[Proxy_SDK] Move generateSignature in WvPLSDKEnvironment to signature_util.cc file.

-------------
[SDK]Add service_certificate type check in WVPL LSDK and PROXY SDK.

-------------
[Proxy_SDK] Add new API to get remote_attestation_cert_serial_number for proxy SDK.

-------------
[Proxy_SDK] Add getDrmDeviceId function

-------------
[Proxy_SDK] add getrequesttype function for proxy sdk

-------------
[SDK] Add videoFeature field to WvPLWidevinePsshData in WvPLWidevine.java and wvpl_type.h. Related to []

-------------
Allow specified devices to request licenses even if these devices are in TEST_ONLY state.
This will also override the global setting of TEST_ONLY devices not being allowed to
successfully receive licenses from Widevine License SDK.

-------------
[Proxy_SDK] Add ParseDCSL function and test case.

-------------
[Proxy_SDK] Return non-ok status for service_certificate_request when create proxy sdk session. Add test case in Java test.

-------------
[Proxy_SDK] Add video_feature parsing in GetPsshData function. Also check video_feature when geneateModularDrmLicenseRequest.

-------------
[SDK]Deprecated message_type() function, use request_type() instead.

-------------
Use JDK instead of JRE

The concept of a JRE is going away in JDK 11. The jre/ subdirectory in the JDK will no longer exist and the :jre targets will no longer make sense.

Currently in JDK 8, the JDK is a superset of the JRE (it contains all of the files in the JRE), so this is a safe change.

Tested:
    TAP found no affected targets
    []

-------------
Renaming WvPLSDKSession.request_type() API.
Added LICENSE_TYPE_UNSPECIFIED enumeration to WvPLLicenseType.

-------------
Additional VLOG messaging for licensing with TEST_ONLY devices.

-------------
Remove forward declarations of absl names. The style guide bans this, and those names are not for external users to redeclare. External users should include the public headers instead.

-------------
Change Kokoro to use latest bazel version

-------------
Update the abseil build to the December 18 release.

This fixes a problem where the MOE build is failing because there was no definition for node_hash_map.

-------------
[CAS_Proxy]Add WvPLCASProxyEnvironmentJNI.cc and com_google_video_widevine_sdk_wvpl_WvPLCASProxyEnvironment.h file to implement JNI layer for WvPLCASProxyEnvironment.

-------------
Apply changes to sdk to match device certificate status list updates.

Cleans up some of the protos we're using for the new SignedDeviceInfo. Also, adjusts the sdk implementation to reflect the proto and service changes.

-------------
[CAS_PROXY]Add WvPLCASProxyEnvironment.java, WvPLCASProxySession.java and WvPLCASProxyTest.java file.

-------------
Add API to return the DRM service certificate by provider.

-------------
[CAS_PROXY]Implement SetDrmServiceCertificate and SetDeviceCertificateStatusList JNI layer.

-------------
Get DeviceInfo from request.

-------------
CAS Proxy SDK updated to 1.1.5.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=248640225
This commit is contained in:
Ramji Chandramouli
2019-05-16 18:14:58 -07:00
parent 74b7f405c8
commit be0bb27305
44 changed files with 1496 additions and 577 deletions

View File

@@ -42,20 +42,20 @@ cc_library(
"//base",
"@abseil_repo//absl/memory",
"//common:client_cert",
"//common:drm_root_certificate",
"//common:drm_service_certificate",
"//common:error_space",
"//common:remote_attestation_verifier",
"//common:status",
"//common:verified_media_pipeline",
"//license_server_sdk/internal:sdk",
"//protos/public:client_identification_proto",
"//protos/public:device_certificate_status_proto",
"//protos/public:errors_proto",
"//protos/public:license_protocol_proto",
"//protos/public:license_server_sdk_proto",
"//protos/public:provisioned_device_info_proto",
"//protos/public:widevine_pssh_proto",
"//protos/public:client_identification_cc_proto",
"//protos/public:drm_certificate_cc_proto",
"//protos/public:errors_cc_proto",
"//protos/public:license_protocol_cc_proto",
"//protos/public:license_server_sdk_cc_proto",
"//protos/public:provisioned_device_info_cc_proto",
"//protos/public:signed_drm_certificate_cc_proto",
"//protos/public:widevine_pssh_cc_proto",
],
)
@@ -73,18 +73,19 @@ cc_library(
"//base",
"@abseil_repo//absl/strings",
"@abseil_repo//absl/synchronization",
"//common:aes_cbc_util",
"//common:device_status_list",
"//common:drm_root_certificate",
"//common:error_space",
"//common:drm_service_certificate",
"//common:sha_util",
"//common:status",
"//common:vmp_checker",
"//license_server_sdk/internal:sdk",
"//protos/public:device_certificate_status_proto",
"//protos/public:errors_proto",
"//protos/public:provisioned_device_info_proto",
"//protos/public:device_certificate_status_cc_proto",
"//protos/public:errors_cc_proto",
"//protos/public:provisioned_device_info_cc_proto",
"//protos/public:drm_certificate_cc_proto",
"//protos/public:signed_device_info_cc_proto",
"//protos/public:signed_drm_certificate_cc_proto",
],
)
@@ -102,24 +103,25 @@ cc_library(
"@abseil_repo//absl/memory",
"@abseil_repo//absl/strings",
"@abseil_repo//absl/synchronization",
"//common:aes_cbc_util",
"//common:client_cert",
"//common:device_status_list",
"//common:drm_root_certificate",
"//common:drm_service_certificate",
"//common:error_space",
"//common:remote_attestation_verifier",
"//common:sha_util",
"//common:status",
"//common:verified_media_pipeline",
"//common:vmp_checker",
"//license_server_sdk/internal:sdk",
"//protos/public:client_identification_proto",
"//protos/public:device_certificate_status_proto",
"//protos/public:errors_proto",
"//protos/public:license_protocol_proto",
"//protos/public:license_server_sdk_proto",
"//protos/public:provisioned_device_info_proto",
"//protos/public:widevine_pssh_proto",
"//protos/public:client_identification_cc_proto",
"//protos/public:device_certificate_status_cc_proto",
"//protos/public:drm_certificate_cc_proto",
"//protos/public:errors_cc_proto",
"//protos/public:license_protocol_cc_proto",
"//protos/public:license_server_sdk_cc_proto",
"//protos/public:provisioned_device_info_cc_proto",
"//protos/public:signed_device_info_cc_proto",
"//protos/public:signed_drm_certificate_cc_proto",
"//protos/public:widevine_pssh_cc_proto",
],
)

View File

@@ -7,35 +7,37 @@
////////////////////////////////////////////////////////////////////////////////
#include "sdk/external/common/wvpl/wvpl_sdk_environment.h"
#include "glog/logging.h"
#include "absl/strings/escaping.h"
#include "absl/strings/str_cat.h"
#include "absl/synchronization/mutex.h"
#include "common/aes_cbc_util.h"
#include "common/device_status_list.h"
#include "common/drm_root_certificate.h"
#include "common/drm_service_certificate.h"
#include "common/error_space.h"
#include "common/sha_util.h"
#include "common/status.h"
#include "common/vmp_checker.h"
#include "license_server_sdk/internal/generate_error_response.h"
#include "protos/public/device_certificate_status.pb.h"
#include "protos/public/drm_certificate.pb.h"
#include "protos/public/errors.pb.h"
#include "protos/public/provisioned_device_info.pb.h"
#include "protos/public/signed_drm_certificate.pb.h"
using widevine::DeviceCertificateStatus;
using widevine::DeviceCertificateStatusList;
using widevine::DeviceStatusList;
using widevine::DrmCertificate;
using widevine::DrmServiceCertificate;
using widevine::error_space;
using widevine::kCertificateTypeDevelopment;
using widevine::kCertificateTypeProduction;
using widevine::kCertificateTypeTesting;
using widevine::OkStatus;
using widevine::ProvisionedDeviceInfo;
using widevine::SignedDeviceCertificateStatusList;
using widevine::SignedDrmCertificate;
using widevine::VmpChecker;
using widevine::crypto_util::EncryptAesCbc;
namespace error = widevine::error;
namespace widevine_server {
@@ -82,8 +84,10 @@ WvPLSDKEnvironment::~WvPLSDKEnvironment() = default;
WvPLStatus WvPLSDKEnvironment::SetDrmServiceCertificate(
const std::string& service_certificate, const std::string& service_private_key,
const std::string& service_private_key_passphrase) {
CHECK(drm_root_certificate()) << "DRM root certificate not set!";
WvPLStatus wvpl_status = DrmServiceCertificate::AddDrmServiceCertificate(
DCHECK(drm_root_certificate());
WvPLStatus wvpl_status = CheckServiceCertificateType(service_certificate);
if (!wvpl_status.ok()) return wvpl_status;
wvpl_status = DrmServiceCertificate::AddDrmServiceCertificate(
drm_root_certificate(), service_certificate, service_private_key,
service_private_key_passphrase);
if (!wvpl_status.ok()) return wvpl_status;
@@ -151,80 +155,24 @@ void WvPLSDKEnvironment::AddDeviceInfo(
device_info_map.InsertOrUpdate(provisioned_device_info);
}
WvPLStatus WvPLSDKEnvironment::GenerateSignature(const std::string& plain_text,
std::string* signature) {
DCHECK(signature);
if (plain_text.empty()) {
return WvPLStatus(error_space, error::INVALID_ARGUMENT,
"Plain_text for signature is empty.");
}
if (signature == nullptr) {
return WvPLStatus(error_space, error::INVALID_ARGUMENT,
"Signature must not be null.");
}
const std::map<std::string, std::string>* config_values = GetConfigValue();
std::map<std::string, std::string>::const_iterator it =
config_values->find(kDrmCertificateType);
it = config_values->find(kProviderIv);
std::string provider_iv;
std::string provider_key;
if (it != config_values->end()) {
provider_iv = absl::HexStringToBytes((*it).second);
if (provider_iv.empty()) {
return WvPLStatus(error_space, error::NOT_FOUND, "Provider IV is empty.");
}
}
it = config_values->find(kProviderKey);
if (it != config_values->end()) {
provider_key = absl::HexStringToBytes((*it).second);
if (provider_key.empty()) {
return WvPLStatus(error_space, error::NOT_FOUND,
"Provider Key is empty.");
}
}
std::string hashed_text = widevine::Sha1_Hash(plain_text);
if (hashed_text.empty()) {
return WvPLStatus(error_space, error::INVALID_ARGUMENT,
"Hash for signature is empty.");
} else {
*signature = EncryptAesCbc(provider_key, provider_iv, hashed_text);
if (signature->empty()) {
return WvPLStatus(error_space, error::INVALID_ARGUMENT,
"Generated signature failed");
}
}
return WvPLStatus();
}
std::map<std::string, std::string>* WvPLSDKEnvironment::config_values_ =
new std::map<std::string, std::string>();
std::map<std::string, std::string>* WvPLSDKEnvironment::GetConfigValue() {
return config_values_;
}
void WvPLSDKEnvironment::SetConfigValue(
const std::map<std::string, std::string>& config_values) {
config_values_->insert(config_values.begin(), config_values.end());
}
WvPLStatus WvPLSDKEnvironment::SetDeviceCertificateStatusList(
const std::string& cert_list) const {
WvPLStatus status;
SignedDeviceCertificateStatusList device_certificate_status_list;
std::string decoded_certificate_status_list;
std::string device_certicate_status_list;
status = DeviceStatusList::ExtractFromProvisioningServiceResponse(
cert_list, &decoded_certificate_status_list,
&device_certicate_status_list);
std::string serialized_device_certicate_status_list;
std::string signature;
status = DeviceStatusList::ExtractFromServiceResponse(
cert_list, &serialized_device_certicate_status_list, &signature);
if (!status.ok()) return status;
DeviceCertificateStatusList certificate_status_list;
if (!certificate_status_list.ParseFromString(device_certicate_status_list)) {
if (!certificate_status_list.ParseFromString(
serialized_device_certicate_status_list)) {
return WvPLStatus(error_space,
widevine::INVALID_CERTIFICATE_STATUS_LIST,
"certificate status list parse error");
}
status = DeviceStatusList::Instance()->UpdateStatusList(
drm_root_certificate_->public_key(), decoded_certificate_status_list,
drm_root_certificate_->public_key(),
serialized_device_certicate_status_list, signature,
device_certificate_expiration_seconds_);
if (!status.ok()) return status;
status = WvPLSDKEnvironment::UpdateProvisionedDeviceInfoMap(
@@ -232,5 +180,44 @@ WvPLStatus WvPLSDKEnvironment::SetDeviceCertificateStatusList(
return status;
}
WvPLStatus WvPLSDKEnvironment::CheckServiceCertificateType(
const std::string& service_certificate) {
SignedDrmCertificate signed_drm_certificate;
DrmCertificate drm_certificate;
std::string drm_service_certificate;
if (signed_drm_certificate.ParseFromString(service_certificate)) {
drm_service_certificate = signed_drm_certificate.drm_certificate();
}
if (!drm_certificate.ParseFromString(drm_service_certificate)) {
return WvPLStatus(error_space, error::INVALID_ARGUMENT,
"Fail to parse service_certificate");
}
// TODO(user): after Q3-2019, only support UNKNOWN_SERVICE_TYPE for LSDK
// whose version is older than 5.0.Here is the design doc.
// (https://docs.google.com/document/d/1QVdQ6YfpjVqqNpRbikCWU7DdMHQLyUE4Mimzs9u61lc/edit#heading=h.gyz0lrew3paj)
if (drm_certificate.type() == DrmCertificate::SERVICE) {
if (GetExpectedServiceCertificateType() ==
DrmCertificate::LICENSE_SERVER_SDK) {
return OkStatus();
}
for (auto type : drm_certificate.service_types()) {
if (type == GetExpectedServiceCertificateType()) {
return OkStatus();
}
}
return WvPLStatus(
error_space, error::INVALID_ARGUMENT,
absl::StrCat("Service type in drm certificate is mismatch"));
}
return WvPLStatus(error_space, error::INVALID_ARGUMENT,
absl::StrCat("Type", drm_certificate.type(),
"Service Certificate is wrong type"));
}
widevine::DrmCertificate::ServiceType
WvPLSDKEnvironment::GetExpectedServiceCertificateType() {
return DrmCertificate::UNKNOWN_SERVICE_TYPE;
}
} // namespace wv_pl_sdk
} // namespace widevine_server

View File

@@ -13,10 +13,12 @@
#include <string>
#include "sdk/external/common/wvpl/wvpl_types.h"
#include "protos/public/drm_certificate.pb.h"
namespace widevine {
class DeviceCertificateStatusList;
class DrmRootCertificate;
class DrmCertificate;
class ProvisionedDeviceInfo;
} // namespace widevine
namespace widevine_server {
@@ -88,8 +90,6 @@ class WvPLSDKEnvironment {
WvPLStatus SetDeviceCertificateStatusList(const std::string& cert_list) const;
static void SetConfigValue(const std::map<std::string, std::string>& config_values);
// Number of seconds until the certificate status list expires after its
// creation time. Default value is 604800 seconds.
uint32_t device_certificate_expiration_seconds_ = 604800;
@@ -99,10 +99,9 @@ class WvPLSDKEnvironment {
// name of the provider hosting this service.
std::string provider_;
// value of the "iv" specified for the provider.
std::string* provider_iv_;
std::string provider_iv_;
// value of the "key" specified for the provider.
std::string* provider_key_;
static std::map<std::string, std::string>* config_values_;
std::string provider_key_;
// is_service_certificate_loaded_ is not thread safe.
bool is_service_certificate_loaded_ = false;
// If true, allow devices not in the certificate status list.
@@ -111,6 +110,15 @@ class WvPLSDKEnvironment {
std::unique_ptr<widevine::DrmRootCertificate> drm_root_certificate_;
private:
// Get the expected service type for drm service certificate.
virtual widevine::DrmCertificate::ServiceType
GetExpectedServiceCertificateType();
// Check the type of |service_certificate|. Returns "OK" if the cert can be
// used for the current SDK, else an error status.
virtual WvPLStatus CheckServiceCertificateType(
const std::string& service_certificate);
/**
* Return provisioned_device_info if the device_info_map_ contains system_id.
*
@@ -126,8 +134,6 @@ class WvPLSDKEnvironment {
static void AddDeviceInfo(
const widevine::ProvisionedDeviceInfo& provisioned_device_info);
static std::map<std::string, std::string>* GetConfigValue();
friend class WvPLSDKSession;
friend class WvPLProxySession;
friend class WvPLProxySessionTest;

View File

@@ -19,10 +19,12 @@
#include "sdk/external/common/wvpl/wvpl_sdk_environment.h"
#include "sdk/external/common/wvpl/wvpl_types.h"
#include "protos/public/client_identification.pb.h"
#include "protos/public/drm_certificate.pb.h"
#include "protos/public/errors.pb.h"
#include "protos/public/license_protocol.pb.h"
#include "protos/public/license_server_sdk.pb.h"
#include "protos/public/provisioned_device_info.pb.h"
#include "protos/public/signed_drm_certificate.pb.h"
#include "protos/public/widevine_pssh.pb.h"
// TODO(user): Mark getProvisionedDeviceInfo as deprecated, move the
@@ -34,7 +36,7 @@
// wvpl_sdk_session_test.cc.
// TODO(user): Remove sdk_license_request_ and both proxy and wvpl LSDK set
// signed_message_request_from_cdm_ when create session.
// TODO(user): Move all the protected memeber variables to private and use
// TODO(user): Move all the protected member variables to private and use
// getter and setter to access it.
// TODO(user): (b/119566765) Refactor ParseLicenseRequest and break it into
// different classes.
@@ -332,8 +334,6 @@ void WvPLSDKSession::CopySessionState(
}
}
MessageType WvPLSDKSession::message_type() const { return message_type_; }
void WvPLSDKSession::CopyHDCP(
HDCP hdcp_value,
License::KeyContainer::OutputProtection* output_protection) {
@@ -504,7 +504,7 @@ WvPLStatus WvPLSDKSession::ParseLicenseRequest() {
case SignedMessage::LICENSE_REQUEST:
// TODO(user): Add CAS enum(s) to message_type_ in wvpl_types.h.
case SignedMessage::CAS_LICENSE_REQUEST:
message_type_ = LICENSE_REQUEST;
type_.set_message_type(LICENSE_REQUEST);
DCHECK(signed_message_request_from_cdm_);
sdk_license_request_ = absl::make_unique<LicenseRequest>();
if (!sdk_license_request_->ParseFromString(
@@ -516,14 +516,17 @@ WvPLStatus WvPLSDKSession::ParseLicenseRequest() {
}
break;
case SignedMessage::SERVICE_CERTIFICATE_REQUEST:
message_type_ = SERVICE_CERTIFICATE_REQUEST;
type_.set_message_type(SERVICE_CERTIFICATE_REQUEST);
return WvPLStatus(error_space,
widevine::SERVICE_CERTIFICATE_REQUEST_MESSAGE,
"Service Certificate Request message received.");
break;
default:
break;
}
}
// This code is used by proxy and wvpl license server sdk.
if (message_type_ == LICENSE_REQUEST) {
if (type_.message_type() == LICENSE_REQUEST) {
// Parse for ClientIdentification in license request.
if (sdk_license_request_->has_client_id() &&
sdk_license_request_->has_encrypted_client_id()) {
@@ -556,13 +559,14 @@ WvPLStatus WvPLSDKSession::ParseLicenseRequest() {
SetSystemId(KeyboxClientCert::GetSystemId(client_id_->token()));
}
if (!HasSystemId()) {
ClientCert* client_cert_ptr = nullptr;
status = ClientCert::Create(
drm_root_certificate_, sdk_license_request_->client_id().type(),
sdk_license_request_->client_id().token(), &client_cert_ptr);
std::unique_ptr<ClientCert> client_cert(client_cert_ptr);
if (client_cert != nullptr) {
SetSystemId(client_cert->system_id());
widevine::SignedDrmCertificate signed_drm_certificate;
if (signed_drm_certificate.ParseFromString(client_id_->token())) {
widevine::DrmCertificate drm_certificate;
if (drm_certificate.ParseFromString(
signed_drm_certificate.drm_certificate())) {
SetSystemId(drm_certificate.system_id());
device_id_ = drm_certificate.serial_number();
}
}
}
// TODO(user): Consider enforcing missing client id here.
@@ -581,7 +585,6 @@ WvPLStatus WvPLSDKSession::ParseLicenseRequest() {
LicenseRequestType request_type =
static_cast<LicenseRequestType>(sdk_license_request_->type());
type_.set_license_request_type(request_type);
type_.set_message_type(message_type_);
if (is_offline_license()) {
type_.set_license_type(OFFLINE);
}
@@ -812,6 +815,9 @@ WvPLStatus WvPLSDKSession::GetPsshData(
wv_pssh.entitled_keys(idx).entitlement_key_size_bytes());
wvpl_widevine_pssh_data->add_entitled_key(wvpl_entitled_key);
}
if (wv_pssh.has_video_feature()) {
wvpl_widevine_pssh_data->set_video_feature(wv_pssh.video_feature());
}
}
return status;
} else if (content_info.init_data_type() ==
@@ -850,9 +856,11 @@ WvPLStatus WvPLSDKSession::GetDeviceInfo(WvPLDeviceInfo* device_info) const {
ProvisionedDeviceInfo provisioned_device_info;
status = LookupDeviceInfo(GetSystemId(), &provisioned_device_info);
if (!status.ok()) {
return status;
LOG(WARNING) << "Request from unknown device. SystemId = "
<< GetSystemId();
}
device_info->set_system_id(provisioned_device_info.system_id());
device_info->set_drm_certificate_serial_number(device_id_);
device_info->set_system_id(GetSystemId());
if (provisioned_device_info.has_soc()) {
device_info->set_soc(provisioned_device_info.soc());
}
@@ -884,7 +892,7 @@ WvPLStatus WvPLSDKSession::GetDeviceInfo(WvPLDeviceInfo* device_info) const {
default:
break;
}
return status;
return OkStatus();
}
WvPLStatus WvPLSDKSession::LookupDeviceInfo(
@@ -904,20 +912,6 @@ uint32_t WvPLSDKSession::GetSystemId() const {
return *system_id_;
}
std::string WvPLSDKSession::session_id() const {
DCHECK(sdk_license_request_);
const LicenseRequest::ContentIdentification& content_id =
sdk_license_request_->content_id();
if (content_id.existing_license().license_id().has_session_id())
return content_id.existing_license().license_id().session_id();
else if (content_id.has_widevine_pssh_data())
return content_id.widevine_pssh_data().request_id();
else if (content_id.has_webm_key_id())
return content_id.webm_key_id().request_id();
else
return std::string();
}
bool WvPLSDKSession::is_offline_license() const {
DCHECK(sdk_license_request_);
if (sdk_license_request_ == nullptr) return false;

View File

@@ -38,7 +38,7 @@ class WvPLSDKSession {
virtual WvPLStatus AddKey(const WvPLKey& key);
// Get the WvPLKey.
virtual const std::vector<WvPLKey>& key() const { return keys_; }
virtual const std::vector<WvPLKey>& keys() const { return keys_; }
// Set the license policy.
virtual void set_policy(const WvPLPlaybackPolicy& policy) {
@@ -95,18 +95,9 @@ class WvPLSDKSession {
*/
virtual WvPLStatus GetDeviceInfo(WvPLDeviceInfo* device_info) const;
/**
* Returns the type of the message handled by this session.
*
* @return MessageType enumeration.
* @deprecated use request_type instead.
* @since end of Q1, 2019
*/
virtual MessageType message_type() const;
virtual PlatformVerificationStatus VerifyPlatform() = 0;
virtual WvPLRequestType request_type() const { return type_; }
virtual WvPLRequestType GetRequestType() const { return type_; }
/**
* Returns true if the license type is offline, otherwise return false.
@@ -115,14 +106,6 @@ class WvPLSDKSession {
*/
virtual bool is_offline_license() const;
/**
* A session id that remains constant throughout a session. All license
* and heartbeat requests in a session have the same session id.
*
* @return string.
*/
virtual std::string session_id() const;
/**
* Returns the license request contains client id or not.
*
@@ -130,16 +113,6 @@ class WvPLSDKSession {
*/
virtual bool has_client_id() const { return has_client_id_; }
/**
* Returns true if remote_attestation_cert_serial_number is not empty.
* Otherwise return false.
*
* @return bool.
*/
virtual bool remote_attestation_verified() {
return !remote_attestation_cert_serial_number_.empty();
}
/**
* Returns true if license request has encrypted_client_id. Otherwise return
* false.
@@ -151,6 +124,7 @@ class WvPLSDKSession {
protected:
const widevine::DrmRootCertificate* drm_root_certificate_;
std::string user_agent_;
std::string device_id_;
std::vector<WvPLKey> keys_;
WvPLPlaybackPolicy policy_;
WvPLSessionInit session_init_;
@@ -158,7 +132,6 @@ class WvPLSDKSession {
std::unique_ptr<widevine::ClientIdentification> client_id_;
bool has_pssh_data_ = false;
bool has_client_id_ = false;
MessageType message_type_ = UNKNOWN;
PlatformVerificationStatus platform_verification_status_ =
PLATFORM_NO_VERIFICATION;
std::unique_ptr<widevine::SignedMessage>

View File

@@ -41,8 +41,27 @@ enum KeyType {
ENTITLEMENT = 2
};
// A shortcut for specifying whether to return keys for the video feature only
// or to return all keys or ignore the video feature.
// The VideoFeatureKeySet only applies when video feature is specified in the
// PSSH.
// LINT.IfChange
enum VideoFeatureKeySet {
VF_UNSPECIFIED = 0,
// License should not include keys for the video feature, instead only
// include keys not associated with the video feature.
VF_EXCLUDED = 1,
// License should only include keys associated with the video feature
// (e.g., HDR).
VF_ONLY = 2,
// License should include keys for the video feature and also for keys
// not associated with the video feature (e.g., SDR keys).
VF_INCLUDED = 3,
};
// LINT.IfChange
enum LicenseType {
LICENSE_TYPE_UNSPECIFIED = 0,
STREAMING = 1,
OFFLINE = 2,
};
@@ -586,10 +605,13 @@ struct WvPLDeviceInfo {
void set_test_device(bool test_device) { test_device_ = test_device; }
bool test_device() const { return test_device_; }
void set_serial_number(const std::string& serial_number) {
serial_number_ = serial_number;
void set_drm_certificate_serial_number(
const std::string& drm_certificate_serial_number) {
drm_certificate_serial_number_ = drm_certificate_serial_number;
}
const std::string& drm_certificate_serial_number() const {
return drm_certificate_serial_number_;
}
const std::string& serial_number() const { return serial_number_; }
void set_service_id(const std::string& service_id) {
service_id_ = service_id;
@@ -611,7 +633,7 @@ struct WvPLDeviceInfo {
// True if the certificate corresponds to a test (non production) device.
bool test_device_;
// 128-bit globally unique serial number of certificate.
std::string serial_number_;
std::string drm_certificate_serial_number_;
// Service identifier (web origin) for the provider which owns the
// certificate.
std::string service_id_;
@@ -975,6 +997,11 @@ struct WvPLWidevinePsshData {
return entitled_keys_;
}
void set_video_feature(const std::string& video_feature) {
video_feature_ = video_feature;
}
const std::string video_feature() const { return video_feature_; }
// Member variables
// A list of key identifiers, for entitlement keys or content keys.
std::list<std::string> key_ids_;
@@ -982,6 +1009,8 @@ struct WvPLWidevinePsshData {
std::string content_id_;
// A list of wrapped keys.
std::list<WvPLEntitledKey> entitled_keys_;
// Video feature identifier.
std::string video_feature_;
};
struct WvPLCasKey {