Extract creation and expiration times from DRM cert

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

Creation and expiration times are extracted from the device DRM
certificate. They are reported as
 * -1 if not set in the proto
 * 0 if unlimited
 * positive number otherwise

Bug: 169740403
Test: WV unit, integraiton tests
Change-Id: I9463954dfeb82b6a88ff5d608ed74d20f2424e83
This commit is contained in:
Rahul Frias
2021-03-13 02:18:56 -08:00
parent 3b15087627
commit 9a350eddbd
6 changed files with 113 additions and 19 deletions

View File

@@ -54,9 +54,13 @@ class CertificateProvisioning {
// Extract serial number and system ID from a DRM Device certificate.
// Either |serial_number| or |system_id| may be null, but not both.
// Both |creation_time_seconds| and |expiration_time_seconds| may be null.
// |creation_time_seconds| and |expiration_time_seconds| will be set to -1
// if not present, 0 if unlimited and a valid time otherwise
static bool ExtractDeviceInfo(const std::string& device_certificate,
std::string* serial_number,
uint32_t* system_id);
std::string* serial_number, uint32_t* system_id,
int64_t* creation_time_seconds,
int64_t* expiration_time_seconds);
// Removes json wrapping if applicable to extract the
// SignedProvisioningMessage

View File

@@ -26,6 +26,7 @@ static const size_t CERTIFICATE_DATA_SIZE = 4 * 1024;
// (NaN in JS translates to 0 in unix timestamp).
static const int64_t NEVER_EXPIRES = 0;
static const int64_t UNLIMITED_DURATION = 0;
static const int64_t INVALID_TIME = -1;
// This is the lower limit. For OEMCrypto v16+ one can query and find how many
// are supported