Add a function named has_encrypted_client_id() check.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=231629247
This commit is contained in:
Widevine Buildbot
2019-01-30 23:05:57 +00:00
parent 40e46b6bdb
commit 7828871b66
8 changed files with 190 additions and 14 deletions

View File

@@ -9,6 +9,7 @@
#ifndef COMMON_STATUS_H_
#define COMMON_STATUS_H_
#include <iosfwd>
#include <string>
#include "util/error_space.h"

Binary file not shown.

View File

@@ -280,13 +280,13 @@ enum ProtocolVersion {
message LicenseRequest {
message ContentIdentification {
message CencDeprecated {
repeated bytes pssh = 1;
message WidevinePsshData {
repeated bytes pssh_data = 1;
optional LicenseType license_type = 2;
optional bytes request_id = 3; // Opaque, client-specified.
}
message WebmDeprecated {
message WebmKeyId {
optional bytes header = 1;
optional LicenseType license_type = 2;
optional bytes request_id = 3; // Opaque, client-specified.
@@ -313,8 +313,8 @@ message LicenseRequest {
oneof content_id_variant {
// Exactly one of these must be present.
CencDeprecated cenc_id_deprecated = 1;
WebmDeprecated webm_id_deprecated = 2;
WidevinePsshData widevine_pssh_data = 1;
WebmKeyId webm_key_id = 2;
ExistingLicense existing_license = 3;
InitData init_data = 4;
}

View File

@@ -127,7 +127,9 @@ class WvPLSDKEnvironment {
const widevine::ProvisionedDeviceInfo& provisioned_device_info);
static std::map<std::string, std::string>* GetConfigValue();
friend class WvPLSDKSession;
friend class WvPLProxySession;
friend class WvPLProxySessionTest;
friend class WvPLSessionTest;
};

View File

@@ -113,6 +113,39 @@ 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.
*
* @return bool.
*/
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.
*
* @return bool.
*/
virtual bool has_encrypted_client_id() { return has_encrypted_client_id_; }
protected:
const widevine::DrmRootCertificate* drm_root_certificate_;
std::string user_agent_;
@@ -132,6 +165,9 @@ class WvPLSDKSession {
std::string remote_attestation_cert_serial_number_;
std::unique_ptr<widevine::LicenseRequest> sdk_license_request_;
LicenseRequestType request_type_;
bool has_session_state_ = false;
bool has_encrypted_client_id_ = false;
virtual WvPLStatus VerifyRemoteAttestation();
// Returns the WvPL Client Capabilities information for the license request
@@ -140,11 +176,25 @@ class WvPLSDKSession {
const widevine::ClientIdentification& client_id,
WvPLClientCapabilities* client_capabilities) const;
// Copies/translates the output protection from a WvPL Key into an SDK
// Copy and translates the Key fields from a WvPL Key into an SDK
// key container.
// Copies
// (1) key id
// (2) key
// (3) video_resolution_constraints
// (4) output protection using CopyOutputProtection
// (5) security_level using CopySecurityLevel
// Translates
// (1) key type
void CopyKey(const WvPLKey& wvpl_key,
widevine::License_KeyContainer* sdk_key_container);
// Copies/translates output_protection in WvPL Key into an SDK key container.
void CopyOutputProtection(
const WvPLKey& wvpl_key,
widevine::License_KeyContainer* sdk_key_container);
const WvPLOutputProtection& wvpl_output_protection,
widevine::License_KeyContainer_OutputProtection* output_protection);
// Copies/translatessecurity_level in WvPL Key into an SDK key container.
virtual void CopySecurityLevel(
const WvPLOutputProtection& output_protection, TrackType track_type,
widevine::License_KeyContainer* key_container);
@@ -154,12 +204,6 @@ class WvPLSDKSession {
virtual void CopyPlaybackPolicy(const WvPLPlaybackPolicy& wvpl_policy,
widevine::License_Policy* sdk_policy);
// Copy the |cgms_value| into the key container. A helper function for
// GenerateLicenseRequestAsJSON.
virtual void CopyCGMS(
CGMS cgms_value,
widevine::License_KeyContainer_OutputProtection* output_protection);
// Copy the |hdcp_value| into the key container.
virtual void CopyHDCP(
HDCP hdcp_value,

View File

@@ -20,6 +20,7 @@
// TODO(user) Split wvpl_types.h into wvpl_common_types.h ,
// wvpl_license_sdk_types.h, wvpl_proxy_sdk_types.h and
// wvpl_packager_sdk_types.h.
// TODO(user) Expose Hdcpsrmrule into WvPLHdcpSrmRule.java.
namespace widevine_server {
namespace wv_pl_sdk {
@@ -40,6 +41,7 @@ enum KeyType {
ENTITLEMENT = 2
};
// LINT.IfChange
enum LicenseType {
STREAMING = 1,
OFFLINE = 2,
@@ -48,6 +50,7 @@ enum LicenseType {
/**
* Represents the type of message. This struct is used by Proxy SDK.
*/
// LINT.IfChange
enum MessageType {
UNKNOWN = 0,
LICENSE_REQUEST = 1,
@@ -95,6 +98,11 @@ enum SecurityLevel {
HW_SECURE_ALL = 5
};
enum HdcpSrmRule {
HDCP_SRM_RULE_NONE = 0,
CURRENT_SRM = 1,
};
enum DeviceSecurityLevel {
DEVICE_LEVEL_UNSPECIFIED = 0,
DEVICE_LEVEL_1 = 1,
@@ -125,6 +133,41 @@ enum AnalogOutputCapabilities {
ANALOG_OUTPUT_SUPPORTS_CGMS_A = 3,
};
/*
* Defines the type wrapper for wvpl request.
*/
struct WvPLRequestType {
WvPLRequestType() {
message_type_ = UNKNOWN;
license_type_ = STREAMING;
license_request_type_ = REQUEST_TYPE_UNSPECIFIED;
}
void set_message_type(MessageType message_type) {
message_type_ = message_type;
}
MessageType message_type() const { return message_type_; }
void set_license_type(LicenseType license_type) {
license_type_ = license_type;
}
LicenseType license_type() const { return license_type_; }
void set_license_request_type(LicenseRequestType license_request_type) {
license_request_type_ = license_request_type;
}
LicenseRequestType license_request_type() const {
return license_request_type_;
}
// Type of the message, default value is UNKNOWN.
MessageType message_type_;
// Type of the license, default value is Streaming.
LicenseType license_type_;
// Type of the license request, default value is REQUEST_TYPE_UNSPECIFIED.
LicenseRequestType license_request_type_;
};
struct WvPLPlaybackPolicy {
WvPLPlaybackPolicy() {
license_duration_seconds_ = 0;
@@ -370,6 +413,7 @@ struct WvPLVideoResolutionConstraint {
struct WvPLOutputProtection {
WvPLOutputProtection() {
hdcp_ = HDCP_NONE;
hdcp_srm_rule_ = HDCP_SRM_RULE_NONE;
secure_data_path_ = false;
security_level_ = SECURITY_LEVEL_UNDEFINED;
disable_analog_output_ = false;
@@ -412,9 +456,17 @@ struct WvPLOutputProtection {
CGMS cgms() const { return cgms_; }
void set_hdcp_srm_rule(HdcpSrmRule hdcp_srm_rule) {
hdcp_srm_rule_ = hdcp_srm_rule;
}
HdcpSrmRule hdcp_srm_rule() const { return hdcp_srm_rule_; }
// Indicates whether HDCP is required on digital outputs. Default is None.
HDCP hdcp_;
HdcpSrmRule hdcp_srm_rule_;
// Crypto operations and handling of the media must be performed within a
// hardware backed trusted environment. Default is false.
bool secure_data_path_;
@@ -932,6 +984,83 @@ struct WvPLWidevinePsshData {
std::list<WvPLEntitledKey> entitled_keys_;
};
struct WvPLCasKey {
WvPLCasKey() {}
void set_odd_key_id(const std::string& odd_key_id) {
odd_key_id_ = odd_key_id;
}
const std::string& odd_key_id() const { return odd_key_id_; }
void set_odd_key_bytes(const std::string& odd_key_bytes) {
odd_key_bytes_ = odd_key_bytes;
}
const std::string& odd_key_bytes() const { return odd_key_bytes_; }
void set_even_key_id(const std::string& even_key_id) {
even_key_id_ = even_key_id;
}
const std::string& even_key_id() const { return even_key_id_; }
void set_even_key_bytes(const std::string& even_key_bytes) {
even_key_bytes_ = even_key_bytes;
}
const std::string& even_key_bytes() const { return even_key_bytes_; }
void set_track_type(const TrackType track_type) { track_type_ = track_type; }
TrackType track_type() const { return track_type_; }
void set_output_protection(const WvPLOutputProtection& out_prot) {
output_protection_ = out_prot;
}
void set_requested_output_protection(const WvPLOutputProtection& out_prot) {
requested_output_protection_ = out_prot;
}
const WvPLOutputProtection& output_protection() const {
return output_protection_;
}
const WvPLOutputProtection& requested_output_protection() const {
return requested_output_protection_;
}
WvPLOutputProtection* mutable_output_protection() {
return &output_protection_;
}
WvPLOutputProtection* mutable_requested_output_protection() {
return &requested_output_protection_;
}
void set_key_type(const KeyType key_type) { key_type_ = key_type; }
KeyType key_type() const { return key_type_; }
// 'Odd' Key slot identifier.
std::string odd_key_id_;
// 'Odd' Key slot.
std::string odd_key_bytes_;
// 'Even' Key slot identifier.
std::string even_key_id_;
// 'Even' Key slot.
std::string even_key_bytes_;
// track type.
TrackType track_type_ = TRACK_TYPE_UNSPECIFIED;
// Required output protection.
WvPLOutputProtection output_protection_;
// Requested output protection.
WvPLOutputProtection requested_output_protection_;
// Key type from the KeyType enumeration.
KeyType key_type_ = ENTITLEMENT;
};
} // namespace wv_pl_sdk
} // namespace widevine_server