Allow Unprovisioning of Origins
(This is a merge of http://go/wvgerrit/14051) Adds support for passing a special provisioning response ("delete") to the provisioning API in order to unprovision the current origin. Note that the origin MUST be set or else this will fail. The existing, system-only unprovisionDevice() method is unaffected. Bug: 12247651 Change-Id: I16d296397d8e9e73c8f43e36c86838873318a398
This commit is contained in:
@@ -24,6 +24,7 @@ namespace {
|
||||
static const char* const kEnable = "enable";
|
||||
static const char* const kDisable = "disable";
|
||||
static const std::string kPsshTag = "pssh";
|
||||
static const char* const kSpecialUnprovisionResponse = "unprovision";
|
||||
}
|
||||
|
||||
namespace wvdrm {
|
||||
@@ -385,38 +386,35 @@ status_t WVDrmPlugin::provideProvisionResponse(
|
||||
Vector<uint8_t>& certificate,
|
||||
Vector<uint8_t>& wrapped_key) {
|
||||
CdmProvisioningResponse cdmResponse(response.begin(), response.end());
|
||||
string cdmCertificate;
|
||||
string cdmWrappedKey;
|
||||
CdmResponseType res = mCDM->HandleProvisioningResponse(determineOrigin(),
|
||||
cdmResponse,
|
||||
&cdmCertificate,
|
||||
&cdmWrappedKey);
|
||||
if (isCdmResponseTypeSuccess(res)) {
|
||||
certificate.clear();
|
||||
certificate.appendArray(
|
||||
reinterpret_cast<const uint8_t*>(cdmCertificate.data()),
|
||||
cdmCertificate.size());
|
||||
if (cdmResponse == kSpecialUnprovisionResponse) {
|
||||
const std::string origin = determineOrigin();
|
||||
if (origin == EMPTY_ORIGIN) return kErrorNoOriginSpecified;
|
||||
return unprovision(origin);
|
||||
} else {
|
||||
string cdmCertificate;
|
||||
string cdmWrappedKey;
|
||||
CdmResponseType res = mCDM->HandleProvisioningResponse(determineOrigin(),
|
||||
cdmResponse,
|
||||
&cdmCertificate,
|
||||
&cdmWrappedKey);
|
||||
if (isCdmResponseTypeSuccess(res)) {
|
||||
certificate.clear();
|
||||
certificate.appendArray(
|
||||
reinterpret_cast<const uint8_t*>(cdmCertificate.data()),
|
||||
cdmCertificate.size());
|
||||
|
||||
wrapped_key.clear();
|
||||
wrapped_key.appendArray(
|
||||
reinterpret_cast<const uint8_t*>(cdmWrappedKey.data()),
|
||||
cdmWrappedKey.size());
|
||||
wrapped_key.clear();
|
||||
wrapped_key.appendArray(
|
||||
reinterpret_cast<const uint8_t*>(cdmWrappedKey.data()),
|
||||
cdmWrappedKey.size());
|
||||
}
|
||||
|
||||
return mapCdmResponseType(res);
|
||||
}
|
||||
|
||||
return mapCdmResponseType(res);
|
||||
}
|
||||
|
||||
status_t WVDrmPlugin::unprovisionDevice() {
|
||||
CdmResponseType res1 = mCDM->Unprovision(kSecurityLevelL1, determineOrigin());
|
||||
CdmResponseType res3 = mCDM->Unprovision(kSecurityLevelL3, determineOrigin());
|
||||
if (!isCdmResponseTypeSuccess(res1))
|
||||
{
|
||||
return mapCdmResponseType(res1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return mapCdmResponseType(res3);
|
||||
}
|
||||
return unprovision(EMPTY_ORIGIN);
|
||||
}
|
||||
|
||||
status_t WVDrmPlugin::getSecureStop(const Vector<uint8_t>& ssid,
|
||||
@@ -1027,6 +1025,19 @@ bool WVDrmPlugin::InitDataResemblesPSSH(const Vector<uint8_t>& initData) {
|
||||
return id == kPsshTag;
|
||||
}
|
||||
|
||||
status_t WVDrmPlugin::unprovision(const std::string& origin) {
|
||||
CdmResponseType res1 = mCDM->Unprovision(kSecurityLevelL1, origin);
|
||||
CdmResponseType res3 = mCDM->Unprovision(kSecurityLevelL3, origin);
|
||||
if (!isCdmResponseTypeSuccess(res1))
|
||||
{
|
||||
return mapCdmResponseType(res1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return mapCdmResponseType(res3);
|
||||
}
|
||||
}
|
||||
|
||||
const char* WVDrmPlugin::determineOrigin() const {
|
||||
return mOrigin.empty() ? EMPTY_ORIGIN : mOrigin.c_str();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user