Allow two DRM certificates for each identifier

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

This allows for a default DRM certificate that includes an expiration
time and a legacy one without for each app+origin specific identifier.
Existing offline licenses/secure stops are not associated with a
certificate, and so we cannot delete legacy certificates even after
fetching a new one. New offline licenses/secure stops will be associated
with certificate information, so we will not have this problem going
forward.

Bug: 169740403
Test: WV unit/integration tests
Change-Id: I0f08f6bf98775fd43927243dc4a9f75f21bfbbcc
This commit is contained in:
Rahul Frias
2021-03-06 22:49:41 -08:00
parent 2cf17c34fe
commit 3b15087627
4 changed files with 192 additions and 5 deletions

View File

@@ -29,9 +29,6 @@
namespace wvcdm {
namespace {
const char kCertificateFileNamePrefix[] = "cert";
const char kCertificateFileNameExt[] = ".bin";
const char kCertificateFileName[] = "cert.bin";
std::string GetFileNameSafeHash(const std::string& input) {
std::vector<uint8_t> hash(MD5_DIGEST_LENGTH);
@@ -54,6 +51,10 @@ std::string GetFileNameForIdentifier(const std::string path,
if (file_name == kCertificateFileName && !identifier.empty()) {
const std::string hash = GetFileNameSafeHash(identifier);
file_name = kCertificateFileNamePrefix + hash + kCertificateFileNameExt;
} else if (file_name == kLegacyCertificateFileName && !identifier.empty()) {
const std::string hash = GetFileNameSafeHash(identifier);
file_name =
kLegacyCertificateFileNamePrefix + hash + kCertificateFileNameExt;
}
if (dir_path.empty())