Merge "Make CdmProvisioningResponse const and DeviceFiles level support"
This commit is contained in:
@@ -122,7 +122,7 @@ class CdmEngine {
|
|||||||
std::string* default_url);
|
std::string* default_url);
|
||||||
|
|
||||||
virtual CdmResponseType HandleProvisioningResponse(
|
virtual CdmResponseType HandleProvisioningResponse(
|
||||||
const std::string& origin, CdmProvisioningResponse& response,
|
const std::string& origin, const CdmProvisioningResponse& response,
|
||||||
std::string* cert, std::string* wrapped_key);
|
std::string* cert, std::string* wrapped_key);
|
||||||
|
|
||||||
virtual bool IsProvisioned(CdmSecurityLevel security_level,
|
virtual bool IsProvisioned(CdmSecurityLevel security_level,
|
||||||
|
|||||||
@@ -25,8 +25,9 @@ class CertificateProvisioning {
|
|||||||
const std::string& origin,
|
const std::string& origin,
|
||||||
CdmProvisioningRequest* request,
|
CdmProvisioningRequest* request,
|
||||||
std::string* default_url);
|
std::string* default_url);
|
||||||
CdmResponseType HandleProvisioningResponse(const std::string& origin,
|
CdmResponseType HandleProvisioningResponse(
|
||||||
CdmProvisioningResponse& response,
|
const std::string& origin,
|
||||||
|
const CdmProvisioningResponse& response,
|
||||||
std::string* cert,
|
std::string* cert,
|
||||||
std::string* wrapped_key);
|
std::string* wrapped_key);
|
||||||
|
|
||||||
|
|||||||
@@ -58,8 +58,6 @@ class Properties {
|
|||||||
static bool GetSecurityLevelDirectories(std::vector<std::string>* dirs);
|
static bool GetSecurityLevelDirectories(std::vector<std::string>* dirs);
|
||||||
static bool GetApplicationId(const CdmSessionId& session_id,
|
static bool GetApplicationId(const CdmSessionId& session_id,
|
||||||
std::string* app_id);
|
std::string* app_id);
|
||||||
static bool GetSecurityLevel(const CdmSessionId& session_id,
|
|
||||||
std::string* security_level);
|
|
||||||
static bool GetServiceCertificate(const CdmSessionId& session_id,
|
static bool GetServiceCertificate(const CdmSessionId& session_id,
|
||||||
std::string* service_certificate);
|
std::string* service_certificate);
|
||||||
static bool UsePrivacyMode(const CdmSessionId& session_id);
|
static bool UsePrivacyMode(const CdmSessionId& session_id);
|
||||||
|
|||||||
@@ -589,7 +589,7 @@ CdmResponseType CdmEngine::GetProvisioningRequest(
|
|||||||
* Returns NO_ERROR for success and CdmResponseType error code if fails.
|
* Returns NO_ERROR for success and CdmResponseType error code if fails.
|
||||||
*/
|
*/
|
||||||
CdmResponseType CdmEngine::HandleProvisioningResponse(
|
CdmResponseType CdmEngine::HandleProvisioningResponse(
|
||||||
const std::string& origin, CdmProvisioningResponse& response,
|
const std::string& origin, const CdmProvisioningResponse& response,
|
||||||
std::string* cert, std::string* wrapped_key) {
|
std::string* cert, std::string* wrapped_key) {
|
||||||
if (response.empty()) {
|
if (response.empty()) {
|
||||||
LOGE("CdmEngine::HandleProvisioningResponse: Empty provisioning response.");
|
LOGE("CdmEngine::HandleProvisioningResponse: Empty provisioning response.");
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ bool CertificateProvisioning::ParseJsonResponse(
|
|||||||
* Returns NO_ERROR for success and CERT_PROVISIONING_RESPONSE_ERROR_? if fails.
|
* Returns NO_ERROR for success and CERT_PROVISIONING_RESPONSE_ERROR_? if fails.
|
||||||
*/
|
*/
|
||||||
CdmResponseType CertificateProvisioning::HandleProvisioningResponse(
|
CdmResponseType CertificateProvisioning::HandleProvisioningResponse(
|
||||||
const std::string& origin, CdmProvisioningResponse& response,
|
const std::string& origin, const CdmProvisioningResponse& response,
|
||||||
std::string* cert, std::string* wrapped_key) {
|
std::string* cert, std::string* wrapped_key) {
|
||||||
// Extracts signed response from JSON string, decodes base64 signed response
|
// Extracts signed response from JSON string, decodes base64 signed response
|
||||||
const std::string kMessageStart = "\"signedResponse\": \"";
|
const std::string kMessageStart = "\"signedResponse\": \"";
|
||||||
|
|||||||
@@ -76,12 +76,8 @@ DeviceFiles::~DeviceFiles() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool DeviceFiles::Init(CdmSecurityLevel security_level) {
|
bool DeviceFiles::Init(CdmSecurityLevel security_level) {
|
||||||
switch (security_level) {
|
std::string path;
|
||||||
case kSecurityLevelL1:
|
if (!Properties::GetDeviceFilesBasePath(security_level, &path)) {
|
||||||
case kSecurityLevelL2:
|
|
||||||
case kSecurityLevelL3:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
LOGW("DeviceFiles::Init: Unsupported security level %d", security_level);
|
LOGW("DeviceFiles::Init: Unsupported security level %d", security_level);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,17 +58,6 @@ bool Properties::GetApplicationId(const CdmSessionId& session_id,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Properties::GetSecurityLevel(const CdmSessionId& session_id,
|
|
||||||
std::string* security_level) {
|
|
||||||
const CdmClientPropertySet* property_set =
|
|
||||||
GetCdmClientPropertySet(session_id);
|
|
||||||
if (NULL == property_set) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
*security_level = property_set->security_level();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Properties::GetServiceCertificate(const CdmSessionId& session_id,
|
bool Properties::GetServiceCertificate(const CdmSessionId& session_id,
|
||||||
std::string* service_certificate) {
|
std::string* service_certificate) {
|
||||||
const CdmClientPropertySet* property_set =
|
const CdmClientPropertySet* property_set =
|
||||||
|
|||||||
@@ -957,17 +957,29 @@ TEST_F(WvCdmRequestLicenseTest, PropertySetTest) {
|
|||||||
decryptor_.OpenSession(g_key_system, &property_set_Ln, EMPTY_ORIGIN, NULL,
|
decryptor_.OpenSession(g_key_system, &property_set_Ln, EMPTY_ORIGIN, NULL,
|
||||||
&session_id_Ln);
|
&session_id_Ln);
|
||||||
|
|
||||||
std::string security_level;
|
CdmQueryMap query_info;
|
||||||
EXPECT_TRUE(Properties::GetSecurityLevel(session_id_L1, &security_level));
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
||||||
|
decryptor_.QuerySessionStatus(session_id_L1, &query_info));
|
||||||
|
CdmQueryMap::iterator itr = query_info.find(wvcdm::QUERY_KEY_SECURITY_LEVEL);
|
||||||
|
EXPECT_TRUE(itr != query_info.end());
|
||||||
|
std::string security_level = itr->second;
|
||||||
EXPECT_TRUE(!security_level.compare(QUERY_VALUE_SECURITY_LEVEL_L1) ||
|
EXPECT_TRUE(!security_level.compare(QUERY_VALUE_SECURITY_LEVEL_L1) ||
|
||||||
!security_level.compare(QUERY_VALUE_SECURITY_LEVEL_L3));
|
!security_level.compare(QUERY_VALUE_SECURITY_LEVEL_L3));
|
||||||
EXPECT_TRUE(Properties::UsePrivacyMode(session_id_L1));
|
EXPECT_TRUE(Properties::UsePrivacyMode(session_id_L1));
|
||||||
|
|
||||||
EXPECT_TRUE(Properties::GetSecurityLevel(session_id_L3, &security_level));
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
||||||
|
decryptor_.QuerySessionStatus(session_id_L3, &query_info));
|
||||||
|
itr = query_info.find(wvcdm::QUERY_KEY_SECURITY_LEVEL);
|
||||||
|
EXPECT_TRUE(itr != query_info.end());
|
||||||
|
security_level = itr->second;
|
||||||
EXPECT_EQ(security_level, QUERY_VALUE_SECURITY_LEVEL_L3);
|
EXPECT_EQ(security_level, QUERY_VALUE_SECURITY_LEVEL_L3);
|
||||||
EXPECT_FALSE(Properties::UsePrivacyMode(session_id_L3));
|
EXPECT_FALSE(Properties::UsePrivacyMode(session_id_L3));
|
||||||
|
|
||||||
EXPECT_TRUE(Properties::GetSecurityLevel(session_id_Ln, &security_level));
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
||||||
|
decryptor_.QuerySessionStatus(session_id_Ln, &query_info));
|
||||||
|
itr = query_info.find(wvcdm::QUERY_KEY_SECURITY_LEVEL);
|
||||||
|
EXPECT_TRUE(itr != query_info.end());
|
||||||
|
security_level = itr->second;
|
||||||
EXPECT_TRUE(security_level.empty() ||
|
EXPECT_TRUE(security_level.empty() ||
|
||||||
!security_level.compare(QUERY_VALUE_SECURITY_LEVEL_L3));
|
!security_level.compare(QUERY_VALUE_SECURITY_LEVEL_L3));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user