Correct error returned when license is for the future
[ Merge of http://go/wvgerrit/25721 ] Return CryptoException with errorCode ERROR_NO_KEY when an attempt is made to make use of a license whose start time is in the future. Test: Verified by WidevineDashPolicyTests#testL1LicenseStart2030 b/31914841 Change-Id: I2a157c227550a2391b6536365f34f1dfec3dea0c
This commit is contained in:
@@ -299,29 +299,38 @@ status_t WVCryptoPlugin::attemptDecrypt(const CdmDecryptionParameters& params,
|
||||
mSessionId.c_str(),
|
||||
params.is_encrypted ? "encrypted" : "unencrypted",
|
||||
res);
|
||||
if (res == wvcdm::INSUFFICIENT_CRYPTO_RESOURCES) {
|
||||
errorDetailMsg->setTo(
|
||||
"Error decrypting data: insufficient crypto resources");
|
||||
// This error is actionable by the app and should be passed up.
|
||||
return mapCdmResponseType(res);
|
||||
} else if (res == wvcdm::NEED_KEY) {
|
||||
errorDetailMsg->setTo(
|
||||
"Error decrypting data: requested key has not been loaded");
|
||||
// This error is actionable by the app and should be passed up.
|
||||
return mapCdmResponseType(res);
|
||||
} else if (res == wvcdm::SESSION_NOT_FOUND_FOR_DECRYPT) {
|
||||
errorDetailMsg->setTo(
|
||||
"Error decrypting data: session not found, possibly reclaimed");
|
||||
// This error is actionable by the app and should be passed up.
|
||||
return mapCdmResponseType(res);
|
||||
} else if (res == wvcdm::DECRYPT_ERROR) {
|
||||
errorDetailMsg->setTo(
|
||||
"Error decrypting data: unspecified error");
|
||||
// This error is actionable by the app and should be passed up.
|
||||
return mapCdmResponseType(res);
|
||||
} else if (res == wvcdm::INSUFFICIENT_OUTPUT_PROTECTION) {
|
||||
errorDetailMsg->setTo(
|
||||
"Error decrypting data: insufficient output protection");
|
||||
bool actionableError = true;
|
||||
switch (res) {
|
||||
case wvcdm::INSUFFICIENT_CRYPTO_RESOURCES:
|
||||
errorDetailMsg->setTo(
|
||||
"Error decrypting data: insufficient crypto resources");
|
||||
break;
|
||||
case wvcdm::NEED_KEY:
|
||||
errorDetailMsg->setTo(
|
||||
"Error decrypting data: requested key has not been loaded");
|
||||
break;
|
||||
case wvcdm::DECRYPT_NOT_READY:
|
||||
errorDetailMsg->setTo(
|
||||
"Error decrypting data: license validity period is in the future");
|
||||
break;
|
||||
case wvcdm::SESSION_NOT_FOUND_FOR_DECRYPT:
|
||||
errorDetailMsg->setTo(
|
||||
"Error decrypting data: session not found, possibly reclaimed");
|
||||
break;
|
||||
case wvcdm::DECRYPT_ERROR:
|
||||
errorDetailMsg->setTo(
|
||||
"Error decrypting data: unspecified error");
|
||||
break;
|
||||
case wvcdm::INSUFFICIENT_OUTPUT_PROTECTION:
|
||||
errorDetailMsg->setTo(
|
||||
"Error decrypting data: insufficient output protection");
|
||||
break;
|
||||
default:
|
||||
actionableError = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (actionableError) {
|
||||
// This error is actionable by the app and should be passed up.
|
||||
return mapCdmResponseType(res);
|
||||
} else {
|
||||
|
||||
@@ -331,29 +331,38 @@ status_t WVCryptoPlugin::attemptDecrypt(const CdmDecryptionParameters& params,
|
||||
mSessionId.c_str(),
|
||||
params.is_encrypted ? "encrypted" : "unencrypted",
|
||||
res);
|
||||
if (res == wvcdm::INSUFFICIENT_CRYPTO_RESOURCES) {
|
||||
errorDetailMsg->assign(
|
||||
"Error decrypting data: insufficient crypto resources");
|
||||
// This error is actionable by the app and should be passed up.
|
||||
return mapCdmResponseType(res);
|
||||
} else if (res == wvcdm::NEED_KEY) {
|
||||
errorDetailMsg->assign(
|
||||
"Error decrypting data: requested key has not been loaded");
|
||||
// This error is actionable by the app and should be passed up.
|
||||
return mapCdmResponseType(res);
|
||||
} else if (res == wvcdm::SESSION_NOT_FOUND_FOR_DECRYPT) {
|
||||
errorDetailMsg->assign(
|
||||
"Error decrypting data: session not found, possibly reclaimed");
|
||||
// This error is actionable by the app and should be passed up.
|
||||
return mapCdmResponseType(res);
|
||||
} else if (res == wvcdm::DECRYPT_ERROR) {
|
||||
errorDetailMsg->assign(
|
||||
"Error decrypting data: unspecified error");
|
||||
// This error is actionable by the app and should be passed up.
|
||||
return mapCdmResponseType(res);
|
||||
} else if (res == wvcdm::INSUFFICIENT_OUTPUT_PROTECTION) {
|
||||
errorDetailMsg->assign(
|
||||
"Error decrypting data: insufficient output protection");
|
||||
bool actionableError = true;
|
||||
switch (res) {
|
||||
case wvcdm::INSUFFICIENT_CRYPTO_RESOURCES:
|
||||
errorDetailMsg->assign(
|
||||
"Error decrypting data: insufficient crypto resources");
|
||||
break;
|
||||
case wvcdm::NEED_KEY:
|
||||
errorDetailMsg->assign(
|
||||
"Error decrypting data: requested key has not been loaded");
|
||||
break;
|
||||
case wvcdm::DECRYPT_NOT_READY:
|
||||
errorDetailMsg->assign(
|
||||
"Error decrypting data: license validity period is in the future");
|
||||
break;
|
||||
case wvcdm::SESSION_NOT_FOUND_FOR_DECRYPT:
|
||||
errorDetailMsg->assign(
|
||||
"Error decrypting data: session not found, possibly reclaimed");
|
||||
break;
|
||||
case wvcdm::DECRYPT_ERROR:
|
||||
errorDetailMsg->assign(
|
||||
"Error decrypting data: unspecified error");
|
||||
break;
|
||||
case wvcdm::INSUFFICIENT_OUTPUT_PROTECTION:
|
||||
errorDetailMsg->assign(
|
||||
"Error decrypting data: insufficient output protection");
|
||||
break;
|
||||
default:
|
||||
actionableError = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (actionableError) {
|
||||
// This error is actionable by the app and should be passed up.
|
||||
return mapCdmResponseType(res);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user