Changes JSON format for provisioning request and response to match server change.

This new format uses the SignedProvisioningMessage proto buffer definition so
the client does not have to parse the message and signature from the JSON
response separately. This change makes it more flexible to extend the fields
in the SignedProvisioningMessage.
Adds Apiary API key to the default provisioning server url.
Fixes a bug in GetCertRequestResponse() where a LOGD() can generate a
fault if there is no response data.

Bug: 8620943

Merge of https://widevine-internal-review.googlesource.com/#/c/5230/
from Widevine CDM repository

Change-Id: I4945ee2d16f88666e41edf990dd07102a9271105
This commit is contained in:
Jeff Tinker
2013-04-25 03:34:31 -07:00
parent f2406daae1
commit b5a782bdb2
3 changed files with 63 additions and 53 deletions

View File

@@ -25,7 +25,9 @@ wvcdm::KeyId g_wrong_key_id;
int g_use_full_path = 0; // cannot use boolean in getopt_long
const std::string kDefaultProvisioningServerUrl =
"http://www-googleapis-test.sandbox.google.com/certificateprovisioning/v1/devicecertificates/create";
"http://www-googleapis-test.sandbox.google.com/"
"certificateprovisioning/v1/devicecertificates/create"
"?key=AIzaSyB-5OLKTx2iU5mko18DfdwK5611JIjbUhE";
} // namespace
namespace wvcdm {
@@ -56,7 +58,7 @@ class WvCdmRequestLicenseTest : public testing::Test {
app_parameters,
&key_msg_,
&server_url), wvcdm::KEY_MESSAGE);
EXPECT_EQ((size_t)0, server_url.size());
EXPECT_EQ(0, static_cast<int>(server_url.size()));
}
void GenerateRenewalRequest(const std::string& key_system,
@@ -71,7 +73,7 @@ class WvCdmRequestLicenseTest : public testing::Test {
app_parameters,
&key_msg_,
&server_url), wvcdm::KEY_MESSAGE);
EXPECT_NE((size_t)0, server_url.size());
EXPECT_NE(0, static_cast<int>(server_url.size()));
}
// posts a request and extracts the drm message from the response
@@ -122,9 +124,11 @@ class WvCdmRequestLicenseTest : public testing::Test {
url_request.PostCertRequest(key_msg_);
std::string response;
int resp_bytes = url_request.GetResponse(response);
LOGD("size=%u, response start: %s", response.size(),
response.substr(0, 1024).c_str());
LOGD("end: %s", response.substr(response.size() - 256).c_str());
if (resp_bytes) {
LOGD("size=%u, response start:\t\rn%s", response.size(),
response.substr(0, 1024).c_str());
LOGD("end:\r\n%s", response.substr(response.size() - 256).c_str());
}
LOGD("end %d bytes response dump", resp_bytes);
// Youtube server returns 400 for invalid message while play server returns