|
|
|
|
@@ -1730,7 +1730,7 @@ class DecryptCallbackTester {
|
|
|
|
|
decryption_parameters.is_encrypted = sub_sample_info_->is_encrypted;
|
|
|
|
|
decryption_parameters.is_secure = sub_sample_info_->is_secure;
|
|
|
|
|
decryption_parameters.subsample_flags = sub_sample_info_->subsample_flags;
|
|
|
|
|
EXPECT_EQ(NO_ERROR,
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->Decrypt(session_id, sub_sample_info_->validate_key_id,
|
|
|
|
|
decryption_parameters));
|
|
|
|
|
}
|
|
|
|
|
@@ -1791,8 +1791,9 @@ class WvCdmRequestLicenseTest : public WvCdmTestBase {
|
|
|
|
|
CdmLicenseType license_type,
|
|
|
|
|
const CdmIdentifier& identifier) {
|
|
|
|
|
CdmAppParameterMap app_parameters;
|
|
|
|
|
GenerateKeyRequest(wvcdm::KEY_MESSAGE, "video/mp4", init_data,
|
|
|
|
|
app_parameters, license_type, identifier, nullptr);
|
|
|
|
|
GenerateKeyRequest(CdmResponseType(wvcdm::KEY_MESSAGE), "video/mp4",
|
|
|
|
|
init_data, app_parameters, license_type, identifier,
|
|
|
|
|
nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GenerateKeyRequest(const std::string& init_data,
|
|
|
|
|
@@ -1807,8 +1808,8 @@ class WvCdmRequestLicenseTest : public WvCdmTestBase {
|
|
|
|
|
CdmLicenseType license_type,
|
|
|
|
|
CdmClientPropertySet* property_set) {
|
|
|
|
|
std::string init_data_type = "video/mp4";
|
|
|
|
|
GenerateKeyRequest(wvcdm::KEY_MESSAGE, init_data_type, init_data,
|
|
|
|
|
app_parameters, license_type, property_set);
|
|
|
|
|
GenerateKeyRequest(CdmResponseType(wvcdm::KEY_MESSAGE), init_data_type,
|
|
|
|
|
init_data, app_parameters, license_type, property_set);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GenerateKeyRequest(CdmResponseType expected_response,
|
|
|
|
|
@@ -2040,8 +2041,8 @@ class WvCdmRequestLicenseTest : public WvCdmTestBase {
|
|
|
|
|
void VerifyKeyRequestResponse(const std::string& server_url,
|
|
|
|
|
const std::string& client_auth, bool is_usage,
|
|
|
|
|
std::string* response) {
|
|
|
|
|
VerifyKeyRequestResponse(wvcdm::KEY_ADDED, server_url, client_auth,
|
|
|
|
|
is_usage, response);
|
|
|
|
|
VerifyKeyRequestResponse(CdmResponseType(wvcdm::KEY_ADDED), server_url,
|
|
|
|
|
client_auth, is_usage, response);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VerifyKeyRequestResponse(CdmResponseType expected_response,
|
|
|
|
|
@@ -2058,7 +2059,7 @@ class WvCdmRequestLicenseTest : public WvCdmTestBase {
|
|
|
|
|
|
|
|
|
|
bool VerifyDecryption(const CdmSessionId& session_id,
|
|
|
|
|
const SubSampleInfo& data) {
|
|
|
|
|
return VerifyDecryption(session_id, data, NO_ERROR);
|
|
|
|
|
return VerifyDecryption(session_id, data, CdmResponseType(wvcdm::NO_ERROR));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool VerifyDecryption(const CdmSessionId& session_id,
|
|
|
|
|
@@ -2074,7 +2075,7 @@ class WvCdmRequestLicenseTest : public WvCdmTestBase {
|
|
|
|
|
CdmResponseType status = decryptor_->Decrypt(
|
|
|
|
|
session_id, data.validate_key_id, decryption_parameters);
|
|
|
|
|
EXPECT_EQ(expected_response, status);
|
|
|
|
|
if (status != NO_ERROR) return false;
|
|
|
|
|
if (status != wvcdm::NO_ERROR) return false;
|
|
|
|
|
|
|
|
|
|
bool result = std::equal(data.decrypt_data.begin(), data.decrypt_data.end(),
|
|
|
|
|
decrypt_buffer.begin());
|
|
|
|
|
@@ -2083,9 +2084,9 @@ class WvCdmRequestLicenseTest : public WvCdmTestBase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Unprovision() {
|
|
|
|
|
EXPECT_EQ(NO_ERROR,
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->Unprovision(kSecurityLevelL1, kDefaultCdmIdentifier));
|
|
|
|
|
EXPECT_EQ(NO_ERROR,
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->Unprovision(kSecurityLevelL3, kDefaultCdmIdentifier));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -2102,7 +2103,7 @@ class WvCdmRequestLicenseTest : public WvCdmTestBase {
|
|
|
|
|
CdmResponseType status = decryptor_->OpenSession(
|
|
|
|
|
config_.key_system(), property_set, identifier, nullptr, &session_id_);
|
|
|
|
|
|
|
|
|
|
if (status == NO_ERROR) {
|
|
|
|
|
if (status == wvcdm::NO_ERROR) {
|
|
|
|
|
wvcdm::CdmAppParameterMap app_parameters;
|
|
|
|
|
status = GenerateKeyRequest(ISO_BMFF_VIDEO_MIME_TYPE, binary_key_id(),
|
|
|
|
|
app_parameters, kLicenseTypeStreaming,
|
|
|
|
|
@@ -2111,14 +2112,14 @@ class WvCdmRequestLicenseTest : public WvCdmTestBase {
|
|
|
|
|
|
|
|
|
|
decryptor_->CloseSession(session_id_);
|
|
|
|
|
|
|
|
|
|
switch (status) {
|
|
|
|
|
case NO_ERROR:
|
|
|
|
|
switch (status.Enum()) {
|
|
|
|
|
case wvcdm::NO_ERROR:
|
|
|
|
|
case KEY_MESSAGE:
|
|
|
|
|
return true;
|
|
|
|
|
case NEED_PROVISIONING:
|
|
|
|
|
return false;
|
|
|
|
|
default:
|
|
|
|
|
EXPECT_EQ(NO_ERROR, status);
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR, status);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -2165,9 +2166,10 @@ class WvCdmRequestLicenseTest : public WvCdmTestBase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string GetSecurityLevel(TestWvCdmClientPropertySet* property_set) {
|
|
|
|
|
EXPECT_EQ(NO_ERROR, decryptor_->OpenSession(
|
|
|
|
|
config_.key_system(), property_set,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr, &session_id_));
|
|
|
|
|
EXPECT_EQ(
|
|
|
|
|
wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->OpenSession(config_.key_system(), property_set,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr, &session_id_));
|
|
|
|
|
CdmQueryMap query_info;
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->QuerySessionStatus(session_id_, &query_info));
|
|
|
|
|
@@ -2334,7 +2336,7 @@ TEST_F(WvCdmRequestLicenseTest, L3ProvisioningTest) {
|
|
|
|
|
|
|
|
|
|
TEST_F(WvCdmRequestLicenseTest, PerOriginProvisioningTest) {
|
|
|
|
|
Unprovision();
|
|
|
|
|
EXPECT_EQ(NO_ERROR,
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->Unprovision(kSecurityLevelL3, kExampleIdentifier));
|
|
|
|
|
Provision();
|
|
|
|
|
|
|
|
|
|
@@ -2344,7 +2346,7 @@ TEST_F(WvCdmRequestLicenseTest, PerOriginProvisioningTest) {
|
|
|
|
|
kDefaultCdmIdentifier, nullptr, &session_id_));
|
|
|
|
|
|
|
|
|
|
CdmAppParameterMap app_parameters;
|
|
|
|
|
EXPECT_EQ(KEY_MESSAGE,
|
|
|
|
|
EXPECT_EQ(wvcdm::KEY_MESSAGE,
|
|
|
|
|
GenerateKeyRequest(ISO_BMFF_VIDEO_MIME_TYPE, binary_key_id(),
|
|
|
|
|
app_parameters, kLicenseTypeStreaming,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr));
|
|
|
|
|
@@ -2365,9 +2367,9 @@ TEST_F(WvCdmRequestLicenseTest, PerOriginProvisioningSupportsOldPaths) {
|
|
|
|
|
ASSERT_EQ("com.example", kExampleIdentifier.origin);
|
|
|
|
|
|
|
|
|
|
// Unprovision the device and delete all files.
|
|
|
|
|
EXPECT_EQ(NO_ERROR,
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->Unprovision(kSecurityLevelL3, kExampleIdentifier));
|
|
|
|
|
EXPECT_EQ(NO_ERROR,
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->Unprovision(kSecurityLevelL3, kDefaultCdmIdentifier));
|
|
|
|
|
Provision(kExampleIdentifier, kLevel3);
|
|
|
|
|
|
|
|
|
|
@@ -2402,7 +2404,7 @@ TEST_F(WvCdmRequestLicenseTest, UnprovisionTest) {
|
|
|
|
|
handle.RetrieveCertificate(false, &certificate, &wrapped_private_key,
|
|
|
|
|
&serial_number, &system_id));
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(NO_ERROR,
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->Unprovision(security_level, kDefaultCdmIdentifier));
|
|
|
|
|
EXPECT_NE(
|
|
|
|
|
DeviceFiles::kCertificateValid,
|
|
|
|
|
@@ -2589,14 +2591,14 @@ TEST_F(WvCdmRequestLicenseTest, ProvisioningRevocationTest) {
|
|
|
|
|
decryptor_->OpenSession(config_.key_system(), nullptr,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr, &session_id_);
|
|
|
|
|
|
|
|
|
|
switch (result) {
|
|
|
|
|
case NO_ERROR:
|
|
|
|
|
switch (result.Enum()) {
|
|
|
|
|
case wvcdm::NO_ERROR:
|
|
|
|
|
decryptor_->CloseSession(session_id_);
|
|
|
|
|
return;
|
|
|
|
|
case NEED_PROVISIONING:
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
EXPECT_EQ(NO_ERROR, result);
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR, result);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -2697,9 +2699,9 @@ TEST_F(WvCdmRequestLicenseTest, ProvisioningRevocationTest) {
|
|
|
|
|
// the specified CDM engine is provisioned only during the certificate's
|
|
|
|
|
// validity period.
|
|
|
|
|
TEST_F(WvCdmRequestLicenseTest, ProvisioningWithExpiringCertTest) {
|
|
|
|
|
EXPECT_EQ(NO_ERROR,
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->Unprovision(kSecurityLevelL1, kExampleIdentifier));
|
|
|
|
|
EXPECT_EQ(NO_ERROR,
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->Unprovision(kSecurityLevelL3, kExampleIdentifier));
|
|
|
|
|
|
|
|
|
|
EXPECT_FALSE(IsProvisioned(kExampleIdentifier, kLevelDefault));
|
|
|
|
|
@@ -2759,23 +2761,25 @@ TEST_F(WvCdmRequestLicenseTest, PropertySetTest) {
|
|
|
|
|
std::string provisioning_server;
|
|
|
|
|
CdmCertificateType cert_type = kCertificateWidevine;
|
|
|
|
|
std::string cert_authority, cert, wrapped_key;
|
|
|
|
|
EXPECT_EQ(NO_ERROR, decryptor_->GetProvisioningRequest(
|
|
|
|
|
cert_type, cert_authority, kDefaultCdmIdentifier,
|
|
|
|
|
kEmptyServiceCertificate, kLevel3, &key_msg_,
|
|
|
|
|
&provisioning_server));
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->GetProvisioningRequest(
|
|
|
|
|
cert_type, cert_authority, kDefaultCdmIdentifier,
|
|
|
|
|
kEmptyServiceCertificate, kLevel3, &key_msg_,
|
|
|
|
|
&provisioning_server));
|
|
|
|
|
EXPECT_THAT(provisioning_server,
|
|
|
|
|
IsSimilarUrlTo(kDefaultProvisioningServerUrl));
|
|
|
|
|
std::string response =
|
|
|
|
|
GetCertRequestResponse(config_.provisioning_server());
|
|
|
|
|
EXPECT_NE(0, static_cast<int>(response.size()));
|
|
|
|
|
EXPECT_EQ(NO_ERROR, decryptor_->HandleProvisioningResponse(
|
|
|
|
|
kDefaultCdmIdentifier, response, kLevel3, &cert,
|
|
|
|
|
&wrapped_key));
|
|
|
|
|
EXPECT_EQ(NO_ERROR, decryptor_->OpenSession(
|
|
|
|
|
config_.key_system(), &property_set_L3,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr, &session_id_L3));
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR, decryptor_->HandleProvisioningResponse(
|
|
|
|
|
kDefaultCdmIdentifier, response, kLevel3,
|
|
|
|
|
&cert, &wrapped_key));
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->OpenSession(config_.key_system(), &property_set_L3,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr,
|
|
|
|
|
&session_id_L3));
|
|
|
|
|
} else {
|
|
|
|
|
EXPECT_EQ(NO_ERROR, sts);
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR, sts);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
property_set_Ln.set_security_level("");
|
|
|
|
|
@@ -2946,9 +2950,9 @@ TEST_F(WvCdmRequestLicenseTest, StreamingWithExpiringCertTest) {
|
|
|
|
|
kExampleIdentifier, nullptr, &session_id_));
|
|
|
|
|
|
|
|
|
|
CdmAppParameterMap app_parameters;
|
|
|
|
|
GenerateKeyRequest(KEY_MESSAGE, ISO_BMFF_VIDEO_MIME_TYPE, binary_key_id(),
|
|
|
|
|
app_parameters, kLicenseTypeStreaming, kExampleIdentifier,
|
|
|
|
|
nullptr);
|
|
|
|
|
GenerateKeyRequest(CdmResponseType(wvcdm::KEY_MESSAGE),
|
|
|
|
|
ISO_BMFF_VIDEO_MIME_TYPE, binary_key_id(), app_parameters,
|
|
|
|
|
kLicenseTypeStreaming, kExampleIdentifier, nullptr);
|
|
|
|
|
VerifyKeyRequestResponse(config_.license_server(), config_.client_auth());
|
|
|
|
|
decryptor_->CloseSession(session_id_);
|
|
|
|
|
|
|
|
|
|
@@ -2958,9 +2962,9 @@ TEST_F(WvCdmRequestLicenseTest, StreamingWithExpiringCertTest) {
|
|
|
|
|
EXPECT_EQ(NO_ERROR,
|
|
|
|
|
decryptor_->OpenSession(config_.key_system(), nullptr,
|
|
|
|
|
kExampleIdentifier, nullptr, &session_id_));
|
|
|
|
|
GenerateKeyRequest(NEED_PROVISIONING, ISO_BMFF_VIDEO_MIME_TYPE,
|
|
|
|
|
binary_key_id(), app_parameters, kLicenseTypeStreaming,
|
|
|
|
|
kExampleIdentifier, nullptr);
|
|
|
|
|
GenerateKeyRequest(CdmResponseType(NEED_PROVISIONING),
|
|
|
|
|
ISO_BMFF_VIDEO_MIME_TYPE, binary_key_id(), app_parameters,
|
|
|
|
|
kLicenseTypeStreaming, kExampleIdentifier, nullptr);
|
|
|
|
|
decryptor_->CloseSession(session_id_);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -3048,9 +3052,9 @@ TEST_F(WvCdmRequestLicenseTest, RestoreOfflineKeysWithExpiringCertTest) {
|
|
|
|
|
kExampleIdentifier, nullptr, &session_id_));
|
|
|
|
|
|
|
|
|
|
CdmAppParameterMap app_parameters;
|
|
|
|
|
GenerateKeyRequest(KEY_MESSAGE, ISO_BMFF_VIDEO_MIME_TYPE, key_id,
|
|
|
|
|
app_parameters, kLicenseTypeOffline, kExampleIdentifier,
|
|
|
|
|
nullptr);
|
|
|
|
|
GenerateKeyRequest(CdmResponseType(wvcdm::KEY_MESSAGE),
|
|
|
|
|
ISO_BMFF_VIDEO_MIME_TYPE, key_id, app_parameters,
|
|
|
|
|
kLicenseTypeOffline, kExampleIdentifier, nullptr);
|
|
|
|
|
VerifyKeyRequestResponse(config_.license_server(), client_auth);
|
|
|
|
|
|
|
|
|
|
const CdmKeySetId key_set_id = key_set_id_;
|
|
|
|
|
@@ -4493,7 +4497,7 @@ TEST_F(WvCdmRequestLicenseTest, DISABLED_OfflineLicenseDecryptionTest) {
|
|
|
|
|
size_t encrypt_length = data.encrypt_data.size();
|
|
|
|
|
decrypt_buffer.resize(encrypt_length);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(NO_ERROR, decryptor_->Decrypt(session_id_,
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR, decryptor_->Decrypt(session_id_,
|
|
|
|
|
data.is_encrypted,
|
|
|
|
|
data.is_secure,
|
|
|
|
|
data.key_id,
|
|
|
|
|
@@ -4554,7 +4558,7 @@ TEST_F(WvCdmRequestLicenseTest, DISABLED_RestoreOfflineLicenseDecryptionTest) {
|
|
|
|
|
size_t encrypt_length = data.encrypt_data.size();
|
|
|
|
|
decrypt_buffer.resize(encrypt_length);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(NO_ERROR, decryptor_->Decrypt(session_id_,
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR, decryptor_->Decrypt(session_id_,
|
|
|
|
|
data.is_encrypted,
|
|
|
|
|
data.is_secure,
|
|
|
|
|
data.key_id,
|
|
|
|
|
@@ -4609,7 +4613,7 @@ TEST_F(WvCdmRequestLicenseTest, KeyControlBlockDecryptionTest) {
|
|
|
|
|
size_t encrypt_length = data[i].encrypt_data.size();
|
|
|
|
|
decrypt_buffer.resize(encrypt_length);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(NO_ERROR, decryptor_->Decrypt(session_id_,
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR, decryptor_->Decrypt(session_id_,
|
|
|
|
|
data.is_encrypted,
|
|
|
|
|
data.is_secure,
|
|
|
|
|
data.key_id,
|
|
|
|
|
@@ -4644,7 +4648,7 @@ TEST_P(WvCdmSessionSharingTest, SessionSharingTest) {
|
|
|
|
|
property_set.set_session_sharing_mode(
|
|
|
|
|
session_sharing_info->session_sharing_enabled);
|
|
|
|
|
|
|
|
|
|
ASSERT_EQ(NO_ERROR,
|
|
|
|
|
ASSERT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->OpenSession(config_.key_system(), &property_set,
|
|
|
|
|
cdm_identifier, nullptr, &session_id_));
|
|
|
|
|
CdmSessionId gp_session_id_1 = session_id_;
|
|
|
|
|
@@ -4659,7 +4663,7 @@ TEST_P(WvCdmSessionSharingTest, SessionSharingTest) {
|
|
|
|
|
"edef8ba979d64acea3c827dcd51d21ed00000014" // Widevine system id
|
|
|
|
|
"08011210bdf1cb4fffc6506b8b7945b0bd2917fb"); // pssh data
|
|
|
|
|
|
|
|
|
|
ASSERT_EQ(NO_ERROR,
|
|
|
|
|
ASSERT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->OpenSession(config_.key_system(), &property_set,
|
|
|
|
|
cdm_identifier, nullptr, &session_id_));
|
|
|
|
|
CdmSessionId gp_session_id_2 = session_id_;
|
|
|
|
|
@@ -4676,7 +4680,7 @@ TEST_P(WvCdmSessionSharingTest, SessionSharingTest) {
|
|
|
|
|
decryption_parameters.subsample_flags = data->subsample_flags;
|
|
|
|
|
|
|
|
|
|
if (session_sharing_info->session_sharing_enabled || !data->is_encrypted) {
|
|
|
|
|
EXPECT_EQ(NO_ERROR,
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->Decrypt(gp_session_id_2, data->validate_key_id,
|
|
|
|
|
decryption_parameters))
|
|
|
|
|
<< "session_sharing_info->session_sharing_enabled "
|
|
|
|
|
@@ -4744,8 +4748,9 @@ TEST_F(WvCdmRequestLicenseTest, SessionSharingTest) {
|
|
|
|
|
decryption_parameters.is_secure = data->is_secure;
|
|
|
|
|
decryption_parameters.subsample_flags = data->subsample_flags;
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(NO_ERROR, decryptor_->Decrypt(session_id1, data->validate_key_id,
|
|
|
|
|
decryption_parameters));
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->Decrypt(session_id1, data->validate_key_id,
|
|
|
|
|
decryption_parameters));
|
|
|
|
|
|
|
|
|
|
sleep(kSingleEncryptedSubSampleIcpLicenseDurationExpiration -
|
|
|
|
|
kSingleEncryptedSubSampleIcpLicenseExpirationWindow);
|
|
|
|
|
@@ -4756,13 +4761,15 @@ TEST_F(WvCdmRequestLicenseTest, SessionSharingTest) {
|
|
|
|
|
GenerateKeyRequest(init_data1, kLicenseTypeStreaming);
|
|
|
|
|
VerifyKeyRequestResponse(config_.license_server(), config_.client_auth());
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(NO_ERROR, decryptor_->Decrypt(session_id1, data->validate_key_id,
|
|
|
|
|
decryption_parameters));
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->Decrypt(session_id1, data->validate_key_id,
|
|
|
|
|
decryption_parameters));
|
|
|
|
|
|
|
|
|
|
sleep(kSingleEncryptedSubSampleIcpLicenseExpirationWindow);
|
|
|
|
|
// session 1 will be expired, shared session 3 will be used to decrypt
|
|
|
|
|
EXPECT_EQ(NO_ERROR, decryptor_->Decrypt(session_id1, data->validate_key_id,
|
|
|
|
|
decryption_parameters));
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->Decrypt(session_id1, data->validate_key_id,
|
|
|
|
|
decryption_parameters));
|
|
|
|
|
|
|
|
|
|
decryptor_->CloseSession(session_id1);
|
|
|
|
|
decryptor_->CloseSession(session_id2);
|
|
|
|
|
@@ -4789,8 +4796,9 @@ TEST_F(WvCdmRequestLicenseTest, DecryptionKeyExpiredTest) {
|
|
|
|
|
decryption_parameters.is_encrypted = data->is_encrypted;
|
|
|
|
|
decryption_parameters.is_secure = data->is_secure;
|
|
|
|
|
decryption_parameters.subsample_flags = data->subsample_flags;
|
|
|
|
|
EXPECT_EQ(NO_ERROR, decryptor_->Decrypt(session_id_, data->validate_key_id,
|
|
|
|
|
decryption_parameters));
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->Decrypt(session_id_, data->validate_key_id,
|
|
|
|
|
decryption_parameters));
|
|
|
|
|
sleep(kSingleEncryptedSubSampleIcpLicenseDurationExpiration +
|
|
|
|
|
kSingleEncryptedSubSampleIcpLicenseExpirationWindow);
|
|
|
|
|
EXPECT_EQ(NEED_KEY, decryptor_->Decrypt(session_id_, data->validate_key_id,
|
|
|
|
|
@@ -4834,8 +4842,8 @@ TEST_F(WvCdmRequestLicenseTest, PlaybackExpiry_DecryptBeforeLicense) {
|
|
|
|
|
|
|
|
|
|
// Decrypt before license is received is expected to fail but should
|
|
|
|
|
// not start the playback timer
|
|
|
|
|
EXPECT_FALSE(
|
|
|
|
|
VerifyDecryption(session_id_, usage_info_sub_samples_icp[0], NEED_KEY));
|
|
|
|
|
EXPECT_FALSE(VerifyDecryption(session_id_, usage_info_sub_samples_icp[0],
|
|
|
|
|
CdmResponseType(NEED_KEY)));
|
|
|
|
|
std::this_thread::sleep_for(kExpirationStreamingClip21PlaybackDurationTimeMs);
|
|
|
|
|
|
|
|
|
|
EXPECT_CALL(listener,
|
|
|
|
|
@@ -4917,7 +4925,7 @@ TEST_P(WvCdmDecryptionTest, DecryptionTest) {
|
|
|
|
|
expected_decrypt_data.insert(expected_decrypt_data.end(),
|
|
|
|
|
(data + i)->decrypt_data.begin(),
|
|
|
|
|
(data + i)->decrypt_data.end());
|
|
|
|
|
EXPECT_EQ(NO_ERROR,
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->Decrypt(session_id_, (data + i)->validate_key_id,
|
|
|
|
|
decryption_parameters));
|
|
|
|
|
|
|
|
|
|
@@ -4974,7 +4982,7 @@ TEST_P(WvCdmSessionSharingNoKeyTest, DecryptionTest) {
|
|
|
|
|
bool can_decrypt = !data->is_encrypted &&
|
|
|
|
|
data->subsample_flags & OEMCrypto_FirstSubsample &&
|
|
|
|
|
data->subsample_flags & OEMCrypto_LastSubsample;
|
|
|
|
|
EXPECT_EQ(can_decrypt ? NO_ERROR : KEY_NOT_FOUND_IN_SESSION,
|
|
|
|
|
EXPECT_EQ(can_decrypt ? wvcdm::NO_ERROR : KEY_NOT_FOUND_IN_SESSION,
|
|
|
|
|
decryptor_->Decrypt(gp_session_id_2, data->validate_key_id,
|
|
|
|
|
decryption_parameters));
|
|
|
|
|
if (can_decrypt) {
|
|
|
|
|
@@ -5008,7 +5016,7 @@ TEST_F(WvCdmRequestLicenseTest, AddHlsStreamingKeyTest) {
|
|
|
|
|
decryptor_->OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
|
|
|
|
|
nullptr, &session_id_);
|
|
|
|
|
CdmAppParameterMap app_parameters;
|
|
|
|
|
GenerateKeyRequest(wvcdm::KEY_MESSAGE, HLS_INIT_DATA_FORMAT,
|
|
|
|
|
GenerateKeyRequest(CdmResponseType(wvcdm::KEY_MESSAGE), HLS_INIT_DATA_FORMAT,
|
|
|
|
|
kAttributeListSampleAes, app_parameters,
|
|
|
|
|
kLicenseTypeStreaming, nullptr);
|
|
|
|
|
// TODO(rfrias): Remove once we switch to git-on-borg
|
|
|
|
|
@@ -5025,7 +5033,7 @@ TEST_P(WvHlsInitDataTest, InvalidHlsFormatTest) {
|
|
|
|
|
nullptr, &session_id_);
|
|
|
|
|
CdmAppParameterMap app_parameters;
|
|
|
|
|
std::string init_data = GetParam();
|
|
|
|
|
GenerateKeyRequest(wvcdm::INIT_DATA_NOT_FOUND, HLS_INIT_DATA_FORMAT,
|
|
|
|
|
GenerateKeyRequest(CdmResponseType(INIT_DATA_NOT_FOUND), HLS_INIT_DATA_FORMAT,
|
|
|
|
|
init_data, app_parameters, kLicenseTypeStreaming, nullptr);
|
|
|
|
|
decryptor_->CloseSession(session_id_);
|
|
|
|
|
}
|
|
|
|
|
@@ -5051,7 +5059,7 @@ TEST_P(WvHlsDecryptionTest, HlsDecryptionTest) {
|
|
|
|
|
decryptor_->OpenSession(config_.key_system(), &client_property_set,
|
|
|
|
|
kDefaultCdmIdentifier, &listener, &session_id_);
|
|
|
|
|
CdmAppParameterMap app_parameters;
|
|
|
|
|
GenerateKeyRequest(wvcdm::KEY_MESSAGE, HLS_INIT_DATA_FORMAT,
|
|
|
|
|
GenerateKeyRequest(CdmResponseType(KEY_MESSAGE), HLS_INIT_DATA_FORMAT,
|
|
|
|
|
info->attribute_list, app_parameters,
|
|
|
|
|
kLicenseTypeStreaming, nullptr);
|
|
|
|
|
// TODO(rfrias): Remove once we switch to git-on-borg
|
|
|
|
|
@@ -5077,7 +5085,7 @@ TEST_P(WvHlsDecryptionTest, HlsDecryptionTest) {
|
|
|
|
|
decryption_parameters.pattern_descriptor.skip_blocks = 9;
|
|
|
|
|
}
|
|
|
|
|
decryption_parameters.subsample_flags = data->subsample_flags;
|
|
|
|
|
EXPECT_EQ(NO_ERROR,
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->Decrypt(session_id_, false, decryption_parameters));
|
|
|
|
|
EXPECT_EQ(data->clear_data,
|
|
|
|
|
std::string(reinterpret_cast<const char*>(&output_buffer[0]),
|
|
|
|
|
@@ -5105,7 +5113,7 @@ TEST_P(WvHlsFourCCBackwardCompatibilityTest, HlsDecryptionTest) {
|
|
|
|
|
decryptor_->OpenSession(config_.key_system(), &client_property_set,
|
|
|
|
|
kDefaultCdmIdentifier, &listener, &session_id_);
|
|
|
|
|
CdmAppParameterMap app_parameters;
|
|
|
|
|
GenerateKeyRequest(wvcdm::KEY_MESSAGE, ISO_BMFF_VIDEO_MIME_TYPE,
|
|
|
|
|
GenerateKeyRequest(CdmResponseType(KEY_MESSAGE), ISO_BMFF_VIDEO_MIME_TYPE,
|
|
|
|
|
info->attribute_list, app_parameters,
|
|
|
|
|
kLicenseTypeStreaming, nullptr);
|
|
|
|
|
// TODO(rfrias): Remove once we switch to git-on-borg
|
|
|
|
|
@@ -5131,7 +5139,7 @@ TEST_P(WvHlsFourCCBackwardCompatibilityTest, HlsDecryptionTest) {
|
|
|
|
|
decryption_parameters.pattern_descriptor.skip_blocks = 9;
|
|
|
|
|
}
|
|
|
|
|
decryption_parameters.subsample_flags = data->subsample_flags;
|
|
|
|
|
EXPECT_EQ(NO_ERROR,
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->Decrypt(session_id_, false, decryption_parameters));
|
|
|
|
|
EXPECT_EQ(data->clear_data,
|
|
|
|
|
std::string(reinterpret_cast<const char*>(&output_buffer[0]),
|
|
|
|
|
@@ -5192,7 +5200,7 @@ TEST_P(WvCenc30Test, DecryptionTest) {
|
|
|
|
|
decryption_parameters.is_secure = false;
|
|
|
|
|
decryption_parameters.cipher_mode = data->cipher_mode;
|
|
|
|
|
decryption_parameters.subsample_flags = data->subsample_flags;
|
|
|
|
|
EXPECT_EQ(NO_ERROR,
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->Decrypt(session_id_, false, decryption_parameters));
|
|
|
|
|
EXPECT_EQ(data->clear_data,
|
|
|
|
|
std::string(reinterpret_cast<const char*>(&output_buffer[0]),
|
|
|
|
|
@@ -5252,7 +5260,7 @@ TEST_P(WvCenc30SwitchCipherModeTest, DecryptionTest) {
|
|
|
|
|
decryption_parameters.is_secure = false;
|
|
|
|
|
decryption_parameters.cipher_mode = data->cipher_mode;
|
|
|
|
|
decryption_parameters.subsample_flags = data->subsample_flags;
|
|
|
|
|
EXPECT_EQ(NO_ERROR,
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->Decrypt(session_id_, false, decryption_parameters));
|
|
|
|
|
EXPECT_EQ(data->clear_data,
|
|
|
|
|
std::string(reinterpret_cast<const char*>(&output_buffer[0]),
|
|
|
|
|
@@ -5270,9 +5278,9 @@ TEST_F(WvCdmRequestLicenseTest, CloseCdmReleaseResourcesTest) {
|
|
|
|
|
Provision(kAlternateCdmIdentifier1, kLevelDefault);
|
|
|
|
|
|
|
|
|
|
// Retrieve a streaming license
|
|
|
|
|
EXPECT_EQ(NO_ERROR, decryptor_->OpenSession(config_.key_system(), nullptr,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr,
|
|
|
|
|
&session_id_));
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR, decryptor_->OpenSession(
|
|
|
|
|
config_.key_system(), nullptr,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr, &session_id_));
|
|
|
|
|
GenerateKeyRequest(binary_key_id(), kLicenseTypeStreaming);
|
|
|
|
|
VerifyKeyRequestResponse(config_.license_server(), config_.client_auth());
|
|
|
|
|
|
|
|
|
|
@@ -5282,21 +5290,22 @@ TEST_F(WvCdmRequestLicenseTest, CloseCdmReleaseResourcesTest) {
|
|
|
|
|
CdmSessionId session_id3;
|
|
|
|
|
CdmSessionId session_id4;
|
|
|
|
|
CdmSessionId alternate_session_id;
|
|
|
|
|
EXPECT_EQ(NO_ERROR, decryptor_->OpenSession(config_.key_system(), nullptr,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr,
|
|
|
|
|
&session_id1));
|
|
|
|
|
EXPECT_EQ(NO_ERROR, decryptor_->OpenSession(config_.key_system(), nullptr,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr,
|
|
|
|
|
&session_id2));
|
|
|
|
|
EXPECT_EQ(NO_ERROR, decryptor_->OpenSession(config_.key_system(), nullptr,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr,
|
|
|
|
|
&session_id3));
|
|
|
|
|
EXPECT_EQ(NO_ERROR, decryptor_->OpenSession(config_.key_system(), nullptr,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr,
|
|
|
|
|
&session_id4));
|
|
|
|
|
EXPECT_EQ(NO_ERROR, decryptor_->OpenSession(config_.key_system(), nullptr,
|
|
|
|
|
kAlternateCdmIdentifier1, nullptr,
|
|
|
|
|
&alternate_session_id));
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR, decryptor_->OpenSession(
|
|
|
|
|
config_.key_system(), nullptr,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr, &session_id1));
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR, decryptor_->OpenSession(
|
|
|
|
|
config_.key_system(), nullptr,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr, &session_id2));
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR, decryptor_->OpenSession(
|
|
|
|
|
config_.key_system(), nullptr,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr, &session_id3));
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR, decryptor_->OpenSession(
|
|
|
|
|
config_.key_system(), nullptr,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr, &session_id4));
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->OpenSession(config_.key_system(), nullptr,
|
|
|
|
|
kAlternateCdmIdentifier1, nullptr,
|
|
|
|
|
&alternate_session_id));
|
|
|
|
|
|
|
|
|
|
// Close all open sessions and disable the timer running for |session_id_|
|
|
|
|
|
decryptor_->CloseCdm(kDefaultCdmIdentifier);
|
|
|
|
|
@@ -5315,9 +5324,9 @@ TEST_F(WvCdmRequestLicenseTest, DISABLED_DecryptPathTest) {
|
|
|
|
|
Provision();
|
|
|
|
|
|
|
|
|
|
// Retrieve a streaming license
|
|
|
|
|
EXPECT_EQ(NO_ERROR, decryptor_->OpenSession(config_.key_system(), nullptr,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr,
|
|
|
|
|
&session_id_));
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR, decryptor_->OpenSession(
|
|
|
|
|
config_.key_system(), nullptr,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr, &session_id_));
|
|
|
|
|
|
|
|
|
|
CdmSessionId invalid_session_id = session_id_ + "more";
|
|
|
|
|
std::string frame_number = std::to_string(5);
|
|
|
|
|
@@ -5329,11 +5338,13 @@ TEST_F(WvCdmRequestLicenseTest, DISABLED_DecryptPathTest) {
|
|
|
|
|
invalid_session_id + kComma + std::to_string(5) + kComma + hash;
|
|
|
|
|
|
|
|
|
|
CdmSessionId session_id;
|
|
|
|
|
EXPECT_NE(NO_ERROR, decryptor_->SetDecryptHash(hash_data, &session_id));
|
|
|
|
|
EXPECT_NE(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->SetDecryptHash(hash_data, &session_id));
|
|
|
|
|
|
|
|
|
|
// Valid hash data
|
|
|
|
|
hash_data = session_id_ + kComma + std::to_string(5) + kComma + hash;
|
|
|
|
|
EXPECT_EQ(NO_ERROR, decryptor_->SetDecryptHash(hash_data, &session_id));
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->SetDecryptHash(hash_data, &session_id));
|
|
|
|
|
EXPECT_EQ(session_id_, session_id);
|
|
|
|
|
|
|
|
|
|
decryptor_->CloseSession(session_id_);
|
|
|
|
|
@@ -5393,19 +5404,21 @@ TEST_F(WvCdmRequestLicenseTest, RemoveOfflineLicenseWithMissingUsageEntry) {
|
|
|
|
|
EXPECT_EQ(DeviceFiles::kNoError, sub_result);
|
|
|
|
|
|
|
|
|
|
std::vector<CdmKeySetId> key_set_ids;
|
|
|
|
|
EXPECT_EQ(NO_ERROR, decryptor_->ListStoredLicenses(
|
|
|
|
|
security_level, kDefaultCdmIdentifier, &key_set_ids));
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->ListStoredLicenses(
|
|
|
|
|
security_level, kDefaultCdmIdentifier, &key_set_ids));
|
|
|
|
|
// Note: It is possible that future changes to the CDM will cause this
|
|
|
|
|
// check to fail (such by filtering results from ListStoreLicenses).
|
|
|
|
|
EXPECT_THAT(key_set_ids, Contains(original_key_set_id));
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(NO_ERROR,
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->RemoveOfflineLicense(
|
|
|
|
|
original_key_set_id, security_level, kDefaultCdmIdentifier));
|
|
|
|
|
|
|
|
|
|
// Verify license has been removed.
|
|
|
|
|
EXPECT_EQ(NO_ERROR, decryptor_->ListStoredLicenses(
|
|
|
|
|
security_level, kDefaultCdmIdentifier, &key_set_ids));
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->ListStoredLicenses(
|
|
|
|
|
security_level, kDefaultCdmIdentifier, &key_set_ids));
|
|
|
|
|
EXPECT_THAT(key_set_ids, Not(Contains(original_key_set_id)));
|
|
|
|
|
|
|
|
|
|
// Re-provision.
|
|
|
|
|
@@ -5426,17 +5439,19 @@ TEST_F(WvCdmRequestLicenseTest, RemoveOfflineLicenseWithMissingUsageEntry) {
|
|
|
|
|
decryptor_->CloseSession(session_id_);
|
|
|
|
|
|
|
|
|
|
// Get list of existing offline licenses.
|
|
|
|
|
EXPECT_EQ(NO_ERROR, decryptor_->ListStoredLicenses(
|
|
|
|
|
security_level, kDefaultCdmIdentifier, &key_set_ids));
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->ListStoredLicenses(
|
|
|
|
|
security_level, kDefaultCdmIdentifier, &key_set_ids));
|
|
|
|
|
EXPECT_THAT(key_set_ids, Contains(original_key_set_id));
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(NO_ERROR,
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->RemoveOfflineLicense(
|
|
|
|
|
original_key_set_id, security_level, kDefaultCdmIdentifier));
|
|
|
|
|
|
|
|
|
|
// Verify license has been removed.
|
|
|
|
|
EXPECT_EQ(NO_ERROR, decryptor_->ListStoredLicenses(
|
|
|
|
|
security_level, kDefaultCdmIdentifier, &key_set_ids));
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR,
|
|
|
|
|
decryptor_->ListStoredLicenses(
|
|
|
|
|
security_level, kDefaultCdmIdentifier, &key_set_ids));
|
|
|
|
|
EXPECT_THAT(key_set_ids, Not(Contains(original_key_set_id)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -5538,14 +5553,14 @@ TEST_F(WvCdmRequestLicenseRollbackTest, Streaming_ExpireAfterRollback) {
|
|
|
|
|
Unprovision();
|
|
|
|
|
Provision();
|
|
|
|
|
|
|
|
|
|
ASSERT_EQ(NO_ERROR, decryptor_->OpenSession(config_.key_system(), nullptr,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr,
|
|
|
|
|
&session_id_));
|
|
|
|
|
ASSERT_EQ(wvcdm::NO_ERROR, decryptor_->OpenSession(
|
|
|
|
|
config_.key_system(), nullptr,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr, &session_id_));
|
|
|
|
|
GenerateKeyRequest(init_data_with_expiry_, kLicenseTypeStreaming);
|
|
|
|
|
VerifyKeyRequestResponse(config_.license_server(), config_.client_auth());
|
|
|
|
|
|
|
|
|
|
// Verify that we can decrypt a subsample to begin with.
|
|
|
|
|
EXPECT_EQ(NO_ERROR, Decrypt(session_id_));
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR, Decrypt(session_id_));
|
|
|
|
|
|
|
|
|
|
RollbackSystemTime(kExpirationWithWindowMs_);
|
|
|
|
|
|
|
|
|
|
@@ -5558,21 +5573,21 @@ TEST_F(WvCdmRequestLicenseRollbackTest, Streaming_ExpireAfterRollback) {
|
|
|
|
|
|
|
|
|
|
RestoreSystemTime();
|
|
|
|
|
|
|
|
|
|
ASSERT_EQ(NO_ERROR, decryptor_->CloseSession(session_id_));
|
|
|
|
|
ASSERT_EQ(wvcdm::NO_ERROR, decryptor_->CloseSession(session_id_));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(WvCdmRequestLicenseRollbackTest, Streaming_ExpireBeforeRollback) {
|
|
|
|
|
Unprovision();
|
|
|
|
|
Provision();
|
|
|
|
|
|
|
|
|
|
ASSERT_EQ(NO_ERROR, decryptor_->OpenSession(config_.key_system(), nullptr,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr,
|
|
|
|
|
&session_id_));
|
|
|
|
|
ASSERT_EQ(wvcdm::NO_ERROR, decryptor_->OpenSession(
|
|
|
|
|
config_.key_system(), nullptr,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr, &session_id_));
|
|
|
|
|
GenerateKeyRequest(init_data_with_expiry_, kLicenseTypeStreaming);
|
|
|
|
|
VerifyKeyRequestResponse(config_.license_server(), config_.client_auth());
|
|
|
|
|
|
|
|
|
|
// Start playback timer.
|
|
|
|
|
EXPECT_EQ(NO_ERROR, Decrypt(session_id_));
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR, Decrypt(session_id_));
|
|
|
|
|
|
|
|
|
|
// Elapse time so that the key should now be considered expired.
|
|
|
|
|
std::this_thread::sleep_for(
|
|
|
|
|
@@ -5587,7 +5602,7 @@ TEST_F(WvCdmRequestLicenseRollbackTest, Streaming_ExpireBeforeRollback) {
|
|
|
|
|
|
|
|
|
|
RestoreSystemTime();
|
|
|
|
|
|
|
|
|
|
ASSERT_EQ(NO_ERROR, decryptor_->CloseSession(session_id_));
|
|
|
|
|
ASSERT_EQ(wvcdm::NO_ERROR, decryptor_->CloseSession(session_id_));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(WvCdmRequestLicenseRollbackTest, Offline_RollbackBeforeRestoreKey) {
|
|
|
|
|
@@ -5598,14 +5613,14 @@ TEST_F(WvCdmRequestLicenseRollbackTest, Offline_RollbackBeforeRestoreKey) {
|
|
|
|
|
std::string client_auth;
|
|
|
|
|
GetOfflineConfiguration(&unused_key_id, &client_auth);
|
|
|
|
|
|
|
|
|
|
ASSERT_EQ(NO_ERROR, decryptor_->OpenSession(config_.key_system(), nullptr,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr,
|
|
|
|
|
&session_id_));
|
|
|
|
|
ASSERT_EQ(wvcdm::NO_ERROR, decryptor_->OpenSession(
|
|
|
|
|
config_.key_system(), nullptr,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr, &session_id_));
|
|
|
|
|
GenerateKeyRequest(init_data_with_expiry_, kLicenseTypeOffline);
|
|
|
|
|
VerifyKeyRequestResponse(config_.license_server(), client_auth);
|
|
|
|
|
|
|
|
|
|
// Verify that we can decrypt a subsample to begin with.
|
|
|
|
|
EXPECT_EQ(NO_ERROR, Decrypt(session_id_));
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR, Decrypt(session_id_));
|
|
|
|
|
|
|
|
|
|
CdmKeySetId key_set_id = key_set_id_;
|
|
|
|
|
EXPECT_FALSE(key_set_id_.empty());
|
|
|
|
|
@@ -5636,7 +5651,7 @@ TEST_F(WvCdmRequestLicenseRollbackTest, Offline_RollbackBeforeRestoreKey) {
|
|
|
|
|
// clock is restored/rolled forward.
|
|
|
|
|
EXPECT_EQ(NEED_KEY, Decrypt(session_id_));
|
|
|
|
|
|
|
|
|
|
ASSERT_EQ(NO_ERROR, decryptor_->CloseSession(session_id_));
|
|
|
|
|
ASSERT_EQ(wvcdm::NO_ERROR, decryptor_->CloseSession(session_id_));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// The difference between this test and Offline_RollbackBeforeRestoreKey is
|
|
|
|
|
@@ -5657,14 +5672,14 @@ TEST_F(WvCdmRequestLicenseRollbackTest,
|
|
|
|
|
GetOfflineConfiguration(&key_id, &client_auth);
|
|
|
|
|
key_id[key_id.size() - 1] = '8';
|
|
|
|
|
|
|
|
|
|
ASSERT_EQ(NO_ERROR, decryptor_->OpenSession(config_.key_system(), nullptr,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr,
|
|
|
|
|
&session_id_));
|
|
|
|
|
ASSERT_EQ(wvcdm::NO_ERROR, decryptor_->OpenSession(
|
|
|
|
|
config_.key_system(), nullptr,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr, &session_id_));
|
|
|
|
|
GenerateKeyRequest(key_id, kLicenseTypeOffline);
|
|
|
|
|
VerifyKeyRequestResponse(config_.license_server(), client_auth);
|
|
|
|
|
|
|
|
|
|
// Verify that we can decrypt a subsample to begin with.
|
|
|
|
|
EXPECT_EQ(NO_ERROR, Decrypt(session_id_));
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR, Decrypt(session_id_));
|
|
|
|
|
|
|
|
|
|
CdmKeySetId key_set_id = key_set_id_;
|
|
|
|
|
EXPECT_FALSE(key_set_id_.empty());
|
|
|
|
|
@@ -5689,7 +5704,7 @@ TEST_F(WvCdmRequestLicenseRollbackTest,
|
|
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(kExpirationWindowMs_));
|
|
|
|
|
|
|
|
|
|
// Verify we can decrypt.
|
|
|
|
|
EXPECT_EQ(NO_ERROR, Decrypt(session_id_));
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR, Decrypt(session_id_));
|
|
|
|
|
|
|
|
|
|
// Sleep for a while more.
|
|
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(kExpirationTimeMs_));
|
|
|
|
|
@@ -5699,7 +5714,7 @@ TEST_F(WvCdmRequestLicenseRollbackTest,
|
|
|
|
|
// licenses (15s). The license should have expired.
|
|
|
|
|
EXPECT_EQ(NEED_KEY, Decrypt(session_id_));
|
|
|
|
|
|
|
|
|
|
ASSERT_EQ(NO_ERROR, decryptor_->CloseSession(session_id_));
|
|
|
|
|
ASSERT_EQ(wvcdm::NO_ERROR, decryptor_->CloseSession(session_id_));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(WvCdmRequestLicenseRollbackTest,
|
|
|
|
|
@@ -5711,9 +5726,9 @@ TEST_F(WvCdmRequestLicenseRollbackTest,
|
|
|
|
|
std::string client_auth;
|
|
|
|
|
GetOfflineConfiguration(&unused_key_id, &client_auth);
|
|
|
|
|
|
|
|
|
|
ASSERT_EQ(NO_ERROR, decryptor_->OpenSession(config_.key_system(), nullptr,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr,
|
|
|
|
|
&session_id_));
|
|
|
|
|
ASSERT_EQ(wvcdm::NO_ERROR, decryptor_->OpenSession(
|
|
|
|
|
config_.key_system(), nullptr,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr, &session_id_));
|
|
|
|
|
GenerateKeyRequest(init_data_with_expiry_, kLicenseTypeOffline);
|
|
|
|
|
VerifyKeyRequestResponse(config_.license_server(), client_auth);
|
|
|
|
|
|
|
|
|
|
@@ -5727,7 +5742,7 @@ TEST_F(WvCdmRequestLicenseRollbackTest,
|
|
|
|
|
EXPECT_EQ(wvcdm::KEY_ADDED, decryptor_->RestoreKey(session_id_, key_set_id));
|
|
|
|
|
|
|
|
|
|
// Start playback timer.
|
|
|
|
|
EXPECT_EQ(NO_ERROR, Decrypt(session_id_));
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR, Decrypt(session_id_));
|
|
|
|
|
|
|
|
|
|
RollbackSystemTime(kExpirationWithWindowMs_);
|
|
|
|
|
|
|
|
|
|
@@ -5742,7 +5757,7 @@ TEST_F(WvCdmRequestLicenseRollbackTest,
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(NEED_KEY, Decrypt(session_id_));
|
|
|
|
|
|
|
|
|
|
ASSERT_EQ(NO_ERROR, decryptor_->CloseSession(session_id_));
|
|
|
|
|
ASSERT_EQ(wvcdm::NO_ERROR, decryptor_->CloseSession(session_id_));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(WvCdmRequestLicenseRollbackTest,
|
|
|
|
|
@@ -5754,9 +5769,9 @@ TEST_F(WvCdmRequestLicenseRollbackTest,
|
|
|
|
|
std::string client_auth;
|
|
|
|
|
GetOfflineConfiguration(&unused_key_id, &client_auth);
|
|
|
|
|
|
|
|
|
|
ASSERT_EQ(NO_ERROR, decryptor_->OpenSession(config_.key_system(), nullptr,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr,
|
|
|
|
|
&session_id_));
|
|
|
|
|
ASSERT_EQ(wvcdm::NO_ERROR, decryptor_->OpenSession(
|
|
|
|
|
config_.key_system(), nullptr,
|
|
|
|
|
kDefaultCdmIdentifier, nullptr, &session_id_));
|
|
|
|
|
GenerateKeyRequest(init_data_with_expiry_, kLicenseTypeOffline);
|
|
|
|
|
VerifyKeyRequestResponse(config_.license_server(), client_auth);
|
|
|
|
|
|
|
|
|
|
@@ -5770,7 +5785,7 @@ TEST_F(WvCdmRequestLicenseRollbackTest,
|
|
|
|
|
EXPECT_EQ(wvcdm::KEY_ADDED, decryptor_->RestoreKey(session_id_, key_set_id));
|
|
|
|
|
|
|
|
|
|
// Start playback timer.
|
|
|
|
|
EXPECT_EQ(NO_ERROR, Decrypt(session_id_));
|
|
|
|
|
EXPECT_EQ(wvcdm::NO_ERROR, Decrypt(session_id_));
|
|
|
|
|
|
|
|
|
|
// Elapse time so that the key should now be considered expired.
|
|
|
|
|
std::this_thread::sleep_for(
|
|
|
|
|
@@ -5785,7 +5800,7 @@ TEST_F(WvCdmRequestLicenseRollbackTest,
|
|
|
|
|
|
|
|
|
|
RestoreSystemTime();
|
|
|
|
|
|
|
|
|
|
ASSERT_EQ(NO_ERROR, decryptor_->CloseSession(session_id_));
|
|
|
|
|
ASSERT_EQ(wvcdm::NO_ERROR, decryptor_->CloseSession(session_id_));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace wvcdm
|
|
|
|
|
|