Merges to android Pi release (part 2)
These are a set of CLs merged from the wv cdm repo to the android repo. * Update service certificate. Author: Gene Morgan <gmorgan@google.com> [ Merge of http://go/wvgerrit/28065 ] The updated service certificate fixes a number of failing tests. There are still some that fail, apparently due to mismatches with key set IDs and usage tables. Also updated QA server URL to point to QA proxy (although neither can be used by this client). Also fixed segfault in CdmTest.ListUsageRecords. * Add CDM APIs for Handling Service Certificates. Author: Gene Morgan <gmorgan@google.com> [ Merge of http://go/wvgerrit/28064 ] The responsibility for managing Service Certificates has been moved out of the CDM. Instead, provide CDM and CdmEngine methods to generate a service certificate request message, and handle a service certificate response. The API client can use these calls if it needs to get the service certificate from the License Server. These functions assume the request and response are base64 (web-safe) encoded (see b/37481392). Not all servers are operating this way yet. Any adaptations for non-compliant servers is handled outside the CDM. See test WvCdmEnginePreProvTest::ServiceCertificateRequestResponse in cdm_engine_test.cpp for an example of this. These changes also eliminate the stored init_data and deferred license type which were used to perform a service certificate request during a license request. * Fix and rename ClosesSessionWithoutReturningError test. Author: Edwin Wong <edwinwong@google.com> [ Merge of http://go/wvgerrit/27880 ] ClosesSessionWithoutReturningError should not check for Status::OK since it is expecting an error code back. The test is renamed to ClosesSessionWithError. Test: libwvdrmdrmplugin_hidl_test BUG: 62205215 * Get rid of default service certificate. Author: Gene Morgan <gmorgan@google.com> [ Merge of http://go/wvgerrit/27981 ] Instead, we need at least two service certs - one for the QA/Test servers, and one for UAT (and prod?) There are still some issues around the signature verififcation of the service cert, and in license_unittest.cpp, the use of the default service cert has been commented out. I don't know why this test needs a service cert. If it really does, then the same mechanism that is used elsewhere for selecting a specific server type will be needed here. BUG: 71650075 Test: Not currently passing. Will be addressed in a subsequent commit in the chain. Change-Id: Ieab815fb202c809ad5714cd0364c4bdfa068f77d
This commit is contained in:
@@ -11,13 +11,11 @@
|
||||
// Certificate Request to the target server to get one. Once the Service
|
||||
// Certificate is established for the session, it should not change.
|
||||
|
||||
#include "license_protocol.pb.h"
|
||||
#include "wv_cdm_types.h"
|
||||
#include <memory>
|
||||
|
||||
namespace video_widevine {
|
||||
class SignedMessage;
|
||||
class LicenseRequest;
|
||||
} // namespace video_widevine
|
||||
#include "license_protocol.pb.h"
|
||||
#include "privacy_crypto.h"
|
||||
#include "wv_cdm_types.h"
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
@@ -25,23 +23,16 @@ class CryptoSession;
|
||||
|
||||
class ServiceCertificate {
|
||||
public:
|
||||
ServiceCertificate() {}
|
||||
ServiceCertificate() : has_certificate_(false) {}
|
||||
virtual ~ServiceCertificate() {}
|
||||
|
||||
// Set up a new service certificate.
|
||||
// Accept a serialized video_widevine::SignedDrmDeviceCertificate message.
|
||||
virtual CdmResponseType Init(const std::string& signed_certificate);
|
||||
|
||||
// Initialize the service certificate.
|
||||
// Set the certificate with no certificate and provider ID.
|
||||
virtual void Clear();
|
||||
|
||||
// Current state of certificate.
|
||||
// If !HasCertificate() and privacy mode is enabled, then should call
|
||||
// PrepareRequest() and pass the request to the license server.
|
||||
virtual bool HasCertificate() { return !certificate_.empty(); }
|
||||
virtual bool HasProviderId() { return !provider_id_.empty(); }
|
||||
virtual const std::string& provider_id() { return provider_id_; }
|
||||
bool has_certificate() const { return has_certificate_; }
|
||||
const std::string certificate() const { return certificate_; }
|
||||
const std::string& provider_id() const { return provider_id_; }
|
||||
|
||||
// Verify the signature for a message.
|
||||
virtual CdmResponseType VerifySignedMessage(const std::string& message,
|
||||
@@ -58,29 +49,23 @@ class ServiceCertificate {
|
||||
const video_widevine::ClientIdentification* clear_client_id,
|
||||
video_widevine::EncryptedClientIdentification* encrypted_client_id);
|
||||
|
||||
// Construct service certificate request.
|
||||
virtual bool PrepareRequest(CdmKeyMessage* signed_request);
|
||||
|
||||
// Parse service certificate response and make it usable.
|
||||
virtual CdmResponseType HandleResponse(
|
||||
const std::string& signed_respnse);
|
||||
|
||||
private:
|
||||
// Verify the signature on the signed service certificate.
|
||||
// Extract and save the certificate and provider_id.
|
||||
// Expected format: serialized video_widevine::SignedDrmDeviceCertificate.
|
||||
virtual CdmResponseType VerifyAndExtract(
|
||||
const std::string& raw_certificate);
|
||||
|
||||
// True while waiting for response to service certificate request.
|
||||
bool fetch_in_progress_;
|
||||
// Track whether object holds valid certificate
|
||||
bool has_certificate_;
|
||||
|
||||
// Certificate, verified and extracted from signed message.
|
||||
std::string certificate_;
|
||||
|
||||
// Certificate serial number.
|
||||
std::string serial_number_;
|
||||
|
||||
// Provider ID, extracted from certificate message.
|
||||
std::string provider_id_;
|
||||
|
||||
// Public key.
|
||||
std::unique_ptr<RsaPublicKey> public_key_;
|
||||
|
||||
CORE_DISALLOW_COPY_AND_ASSIGN(ServiceCertificate);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user