This merges the following changes from the Widevine CDM repository:
da001b6 Add Privacy mode and service certificate
This adds support to the CDM for privacy mode and service certificates.
92bf200 Add support for using Youtube Content Protection server for testing
Enables testing with Youtube Content Protection server. Google Play license
server is still the default. Select YTCP server by using the flag -icp
e.g. adb shell '/system/bin/request_license_test -icp'
85dcd60 Fixes to enable privacy mode
These includes changes to use PKCS7 padding, corrected root CA formatting
and changes to integration test. Also refactored service certificate
handling.
989971c Correction to request license test
Corrected PropertySetTest to provision when needed. Also added disabled
privacy tests to run against YTCP staging server until GooglePlay
integration is complete.
Bug: 10109249
Change-Id: If81d68c65d743d77a485406f48d1be41a74de0af
71 lines
2.1 KiB
C++
71 lines
2.1 KiB
C++
// Copyright 2012 Google Inc. All Rights Reserved.
|
|
|
|
#ifndef CDM_BASE_LICENSE_H_
|
|
#define CDM_BASE_LICENSE_H_
|
|
|
|
#include "wv_cdm_types.h"
|
|
|
|
namespace video_widevine_server {
|
|
namespace sdk {
|
|
class SignedMessage;
|
|
}
|
|
} // namespace video_widevine_server
|
|
|
|
namespace wvcdm {
|
|
|
|
class CryptoSession;
|
|
class PolicyEngine;
|
|
|
|
class CdmLicense {
|
|
public:
|
|
|
|
CdmLicense() : session_(NULL), initialized_(false) {}
|
|
~CdmLicense() {}
|
|
|
|
bool Init(const std::string& token, CryptoSession* session,
|
|
PolicyEngine* policy_engine);
|
|
|
|
bool PrepareKeyRequest(const CdmInitData& pssh_data,
|
|
const CdmLicenseType license_type,
|
|
const CdmAppParameterMap& app_parameters,
|
|
const CdmSessionId& session_id,
|
|
CdmKeyMessage* signed_request,
|
|
std::string* server_url);
|
|
bool PrepareKeyUpdateRequest(bool is_renewal, CdmKeyMessage* signed_request,
|
|
std::string* server_url);
|
|
CdmResponseType HandleKeyResponse(const CdmKeyResponse& license_response);
|
|
CdmResponseType HandleKeyUpdateResponse(
|
|
bool is_renewal, const CdmKeyResponse& license_response);
|
|
|
|
bool RestoreOfflineLicense(CdmKeyMessage& license_request,
|
|
CdmKeyResponse& license_response,
|
|
CdmKeyResponse& license_renewal_response);
|
|
bool HasInitData() { return !init_data_.empty(); }
|
|
|
|
private:
|
|
bool PrepareServiceCertificateRequest(CdmKeyMessage* signed_request,
|
|
std::string* server_url);
|
|
CdmResponseType HandleServiceCertificateResponse(
|
|
const video_widevine_server::sdk::SignedMessage& signed_message);
|
|
|
|
CdmResponseType HandleKeyErrorResponse(
|
|
const video_widevine_server::sdk::SignedMessage& signed_message);
|
|
|
|
CryptoSession* session_;
|
|
PolicyEngine* policy_engine_;
|
|
std::string server_url_;
|
|
std::string token_;
|
|
std::string service_certificate_;
|
|
std::string init_data_;
|
|
bool initialized_;
|
|
|
|
// Used for certificate based licensing
|
|
CdmKeyMessage key_request_;
|
|
|
|
CORE_DISALLOW_COPY_AND_ASSIGN(CdmLicense);
|
|
};
|
|
|
|
} // namespace wvcdm
|
|
|
|
#endif // CDM_BASE_LICENSE_H_
|