Certificate provisioning verification

bug: 8620943

This is a merge of changes made to the Widevine CDM
repository during certificate provisioning verification.

The following changes are included:

Fixes for certificate based licensing
https://widevine-internal-review.googlesource.com/#/c/5162/

Base64 encode and decode now handles non-multiple of 24-bits input
https://widevine-internal-review.googlesource.com/#/c/4981/

Fixed issues with device provisioning response handling
https://widevine-internal-review.googlesource.com/#/c/5153/

Persistent storage to support device certificates
https://widevine-internal-review.googlesource.com/#/c/5161/

Enable loading of certificates
https://widevine-internal-review.googlesource.com/#/c/5172/

Provide license server url
https://widevine-internal-review.googlesource.com/#/c/5173/

Change-Id: I0c032c1ae0055dcc1a7a77ad4b0ea0898030dc7d
This commit is contained in:
Jeff Tinker
2013-04-22 20:05:55 -07:00
parent 3a28eeeb68
commit 958bbe6d05
30 changed files with 1497 additions and 290 deletions

View File

@@ -4,6 +4,7 @@
#include "http_socket.h"
#include "log.h"
#include "string_conversions.h"
namespace wvcdm {
@@ -49,7 +50,7 @@ void UrlRequest::AppendChunkToUpload(const std::string& data) {
int UrlRequest::GetResponse(std::string& response) {
response.clear();
const int kTimeoutInMs = 1500;
const int kTimeoutInMs = 1500 * 2;
int bytes = 0;
int total_bytes = 0;
do {
@@ -102,5 +103,29 @@ bool UrlRequest::PostRequest(const std::string& data) {
return true;
}
void UrlRequest::AppendData(const std::string& data) {
request_.append(data);
request_.append("\r\n"); // marks end of data
}
bool UrlRequest::PostCertRequest(const std::string& data) {
request_.assign("POST /");
request_.append(socket_.resource_path());
request_.append(" HTTP/1.1\r\n");
request_.append("User-Agent: Widevine CDM v1.0\r\n");
request_.append("Host: ");
request_.append(socket_.domain_name());
request_.append("\r\nAccept: */*");
request_.append("\r\nContent-Type: application/json");
request_.append("\r\nContent-Length: ");
request_.append(UintToString(data.size()));
request_.append("\r\n"); // empty line to terminate header
request_.append("\r\n"); // terminates the request
AppendData(data);
socket_.Write(request_.c_str(), request_.size());
return true;
}
} // namespace wvcdm