diff --git a/libwvdrmengine/cdm/core/include/properties.h b/libwvdrmengine/cdm/core/include/properties.h index fa207cc6..9a0b7d00 100644 --- a/libwvdrmengine/cdm/core/include/properties.h +++ b/libwvdrmengine/cdm/core/include/properties.h @@ -55,6 +55,9 @@ class Properties { static inline bool device_files_is_a_real_filesystem() { return device_files_is_a_real_filesystem_; } + static inline bool allow_restore_of_offline_licenses_with_release() { + return allow_restore_of_offline_licenses_with_release_; + } static void set_provisioning_messages_are_binary(bool flag) { provisioning_messages_are_binary_ = flag; } @@ -143,6 +146,7 @@ class Properties { static bool provisioning_messages_are_binary_; static bool allow_service_certificate_requests_; static bool device_files_is_a_real_filesystem_; + static bool allow_restore_of_offline_licenses_with_release_; static std::unique_ptr session_property_set_; CORE_DISALLOW_COPY_AND_ASSIGN(Properties); diff --git a/libwvdrmengine/cdm/core/src/cdm_session.cpp b/libwvdrmengine/cdm/core/src/cdm_session.cpp index 9e3ee8e6..f8318add 100644 --- a/libwvdrmengine/cdm/core/src/cdm_session.cpp +++ b/libwvdrmengine/cdm/core/src/cdm_session.cpp @@ -243,8 +243,10 @@ CdmResponseType CdmSession::RestoreOfflineSession(const CdmKeySetId& key_set_id, // Attempts to restore a released offline license are treated as a release // retry. - if (license_state == DeviceFiles::kLicenseStateReleasing) { - license_type = kLicenseTypeRelease; + if (Properties::allow_restore_of_offline_licenses_with_release()) { + if (license_state == DeviceFiles::kLicenseStateReleasing) { + license_type = kLicenseTypeRelease; + } } // Only restore offline licenses if they are active or this is a release diff --git a/libwvdrmengine/cdm/core/src/properties.cpp b/libwvdrmengine/cdm/core/src/properties.cpp index d49a7e03..336fb6bd 100644 --- a/libwvdrmengine/cdm/core/src/properties.cpp +++ b/libwvdrmengine/cdm/core/src/properties.cpp @@ -20,6 +20,7 @@ bool Properties::oem_crypto_use_userspace_buffers_; bool Properties::provisioning_messages_are_binary_; bool Properties::allow_service_certificate_requests_; bool Properties::device_files_is_a_real_filesystem_; +bool Properties::allow_restore_of_offline_licenses_with_release_; std::unique_ptr Properties::session_property_set_; bool Properties::AddSessionPropertySet(const CdmSessionId& session_id, diff --git a/libwvdrmengine/cdm/include/properties_configuration.h b/libwvdrmengine/cdm/include/properties_configuration.h index 7b8fee14..a013fe57 100644 --- a/libwvdrmengine/cdm/include/properties_configuration.h +++ b/libwvdrmengine/cdm/include/properties_configuration.h @@ -34,6 +34,11 @@ const bool kAllowServiceCertificateRequests = true; // code may treat the DeviceFiles base path as a raw filesystem path. const bool kDeviceFilesIsARealFileSystem = true; +// This controls the restoration of an offline license, on which a +// release attempt was previously made. If true, a restoration +// will be treated as a release request. If false, a restoration will fail. +const bool kAllowRestoreOfflineLicenseWithRelease = false; + } // namespace wvcdm #endif // CDM_BASE_WV_PROPERTIES_CONFIGURATION_H_ diff --git a/libwvdrmengine/cdm/src/properties_android.cpp b/libwvdrmengine/cdm/src/properties_android.cpp index f2b3be24..4ff752d4 100644 --- a/libwvdrmengine/cdm/src/properties_android.cpp +++ b/libwvdrmengine/cdm/src/properties_android.cpp @@ -50,6 +50,8 @@ void Properties::InitOnce() { provisioning_messages_are_binary_ = kPropertyProvisioningMessagesAreBinary; allow_service_certificate_requests_ = kAllowServiceCertificateRequests; device_files_is_a_real_filesystem_ = kDeviceFilesIsARealFileSystem; + allow_restore_of_offline_licenses_with_release_ = + kAllowRestoreOfflineLicenseWithRelease; session_property_set_.reset(new CdmClientPropertySetMap()); } diff --git a/libwvdrmengine/cdm/test/request_license_test.cpp b/libwvdrmengine/cdm/test/request_license_test.cpp index 88b925c0..f40f06cf 100644 --- a/libwvdrmengine/cdm/test/request_license_test.cpp +++ b/libwvdrmengine/cdm/test/request_license_test.cpp @@ -1529,33 +1529,6 @@ FourSampleDecryptionInfo kCenc30SwitchCipherData[8] = { kCenc30Cbc1Key33Sample, kCenc30Cbc1Key32Sample, } }, }; -// NOTE: Provider ID = staging.google.com -const std::string kGoogleStagingServiceCertificate = wvcdm::a2bs_hex( - "0ac102080312101705b917cc1204868b06333a2f772a8c1882b482920522" - "8e023082010a028201010099ed5b3b327dab5e24efc3b62a95b598520ad5" - "bccb37503e0645b814d876b8df40510441ad8ce3adb11bb88c4e725a5e4a" - "9e0795291d58584023a7e1af0e38a91279393008610b6f158c878c7e21bf" - "fbfeea77e1019e1e5781e8a45f46263d14e60e8058a8607adce04fac8457" - "b137a8d67ccdeb33705d983a21fb4eecbd4a10ca47490ca47eaa5d438218" - "ddbaf1cade3392f13d6ffb6442fd31e1bf40b0c604d1c4ba4c9520a4bf97" - "eebd60929afceef55bbaf564e2d0e76cd7c55c73a082b996120b8359edce" - "24707082680d6f67c6d82c4ac5f3134490a74eec37af4b2f010c59e82843" - "e2582f0b6b9f5db0fc5e6edf64fbd308b4711bcf1250019c9f5a09020301" - "00013a146c6963656e73652e7769646576696e652e636f6d128003ae3473" - "14b5a835297f271388fb7bb8cb5277d249823cddd1da30b93339511eb3cc" - "bdea04b944b927c121346efdbdeac9d413917e6ec176a10438460a503bc1" - "952b9ba4e4ce0fc4bfc20a9808aaaf4bfcd19c1dcfcdf574ccac28d1b410" - "416cf9de8804301cbdb334cafcd0d40978423a642e54613df0afcf96ca4a" - "9249d855e42b3a703ef1767f6a9bd36d6bf82be76bbf0cba4fde59d2abcc" - "76feb64247b85c431fbca52266b619fc36979543fca9cbbdbbfafa0e1a55" - "e755a3c7bce655f9646f582ab9cf70aa08b979f867f63a0b2b7fdb362c5b" - "c4ecd555d85bcaa9c593c383c857d49daab77e40b7851ddfd24998808e35" - "b258e75d78eac0ca16f7047304c20d93ede4e8ff1c6f17e6243e3f3da8fc" - "1709870ec45fba823a263f0cefa1f7093b1909928326333705043a29bda6" - "f9b4342cc8df543cb1a1182f7c5fff33f10490faca5b25360b76015e9c5a" - "06ab8ee02f00d2e8d5986104aacc4dd475fd96ee9ce4e326f21b83c70585" - "77b38732cddabc6a6bed13fb0d49d38a45eb87a5f4"); - } // namespace namespace wvcdm { @@ -2114,7 +2087,7 @@ TEST_F(WvCdmRequestLicenseTest, ProvisioningTestWithServiceCertificate) { EXPECT_EQ(wvcdm::NO_ERROR, decryptor_->GetProvisioningRequest( cert_type, cert_authority, kDefaultCdmIdentifier, - kGoogleStagingServiceCertificate, + config_.provisioning_service_certificate(), &key_msg_, &provisioning_server)); EXPECT_EQ(provisioning_server, config_.provisioning_server());