Consolidate provisioning related protobuf parsing

[ Merge of http://go/wvgerrit/87905 ]

Protobuf parsing of the provisioning message has been centralized in
certificate_provisioning.cpp since it will be invoked from
multiple locations. This will also ease maintainability of the code.

Bug: 142731300
Test: android unit/integration tests
Change-Id: Idebf6b0145b317698559cac1cf18a3a0b98315ad
This commit is contained in:
Rahul Frias
2019-10-16 16:30:30 -07:00
parent 3cfd0ae668
commit 8769e12b01
4 changed files with 82 additions and 60 deletions

View File

@@ -48,6 +48,19 @@ class CertificateProvisioning {
FileSystem* file_system, const CdmProvisioningResponse& response,
std::string* cert, std::string* wrapped_key);
// Helper methods
// Extract serial number and system ID from a DRM Device certificate.
// Either |serial_number| or |system_id| may be null, but not both.
static bool ExtractDeviceInfo(const std::string& device_certificate,
std::string* serial_number,
uint32_t* system_id);
// Removes json wrapping if applicable to extract the
// SignedProvisioningMessage
static bool ExtractAndDecodeSignedMessageForTesting(
const std::string& provisioning_response, std::string* result);
private:
CdmResponseType SetSpoidParameter(
const std::string& origin, const std::string& spoid,