Squashed commit of these CLs from the widevine cdm repo: Update YT CP server URI to point to the UAT server https://widevine-internal-review.googlesource.com/#/c/9327/ OEMCrypto Version 9 API https://widevine-internal-review.googlesource.com/#/c/9142/ Correct Device ID length in OEMCrypto reference version https://widevine-internal-review.googlesource.com/#/c/8723/ Modify tests to prevent intermittent failures https://widevine-internal-review.googlesource.com/#/c/8982/ Generate a unique license request ID https://widevine-internal-review.googlesource.com/#/c/8721/ Re-enable android timer mechanisms https://widevine-internal-review.googlesource.com/#/c/8833/ Do not close CDM session on removeKeys https://widevine-internal-review.googlesource.com/#/c/8703/ And numerous changes required by Eureka, Steel, and CTE versions of Widevine CDM, as highlighted here: https://widevine-internal-review.googlesource.com/#/c/8596/ https://widevine-internal-review.googlesource.com/#/c/8955/ https://widevine-internal-review.googlesource.com/#/c/8922/ https://widevine-internal-review.googlesource.com/#/c/8890/ https://widevine-internal-review.googlesource.com/#/c/8871/ https://widevine-internal-review.googlesource.com/#/c/8706/ https://widevine-internal-review.googlesource.com/#/c/8425/ Change-Id: Iafd33905227e74eb2132c240b929d2282ab68042
77 lines
2.7 KiB
C++
77 lines
2.7 KiB
C++
// Copyright 2013 Google Inc. All Rights Reserved.
|
|
//
|
|
#ifndef CDM_BASE_DEVICE_FILES_H_
|
|
#define CDM_BASE_DEVICE_FILES_H_
|
|
|
|
#include "wv_cdm_types.h"
|
|
|
|
namespace wvcdm {
|
|
|
|
class File;
|
|
|
|
class DeviceFiles {
|
|
public:
|
|
typedef enum {
|
|
kLicenseStateActive,
|
|
kLicenseStateReleasing,
|
|
kLicenseStateUnknown,
|
|
} LicenseState;
|
|
|
|
DeviceFiles(): file_(NULL), security_level_(kSecurityLevelUninitialized),
|
|
initialized_(false) {}
|
|
virtual ~DeviceFiles() {}
|
|
|
|
virtual bool Init(const File* handle, CdmSecurityLevel security_level);
|
|
|
|
virtual bool StoreCertificate(const std::string& certificate,
|
|
const std::string& wrapped_private_key);
|
|
virtual bool RetrieveCertificate(std::string* certificate,
|
|
std::string* wrapped_private_key);
|
|
|
|
virtual bool StoreLicense(const std::string& key_set_id,
|
|
const LicenseState state,
|
|
const CdmInitData& pssh_data,
|
|
const CdmKeyMessage& key_request,
|
|
const CdmKeyResponse& key_response,
|
|
const CdmKeyMessage& key_renewal_request,
|
|
const CdmKeyResponse& key_renewal_response,
|
|
const std::string& release_server_url);
|
|
virtual bool RetrieveLicense(const std::string& key_set_id,
|
|
LicenseState* state,
|
|
CdmInitData* pssh_data,
|
|
CdmKeyMessage* key_request,
|
|
CdmKeyResponse* key_response,
|
|
CdmKeyMessage* key_renewal_request,
|
|
CdmKeyResponse* key_renewal_response,
|
|
std::string* release_server_url);
|
|
virtual bool DeleteLicense(const std::string& key_set_id);
|
|
virtual bool DeleteAllFiles();
|
|
virtual bool DeleteAllLicenses();
|
|
virtual bool LicenseExists(const std::string& key_set_id);
|
|
|
|
// For testing only
|
|
static std::string GetCertificateFileName();
|
|
static std::string GetLicenseFileNameExtension();
|
|
|
|
protected:
|
|
bool Hash(const std::string& data, std::string* hash);
|
|
bool StoreFile(const char* name, const std::string& data);
|
|
bool RetrieveFile(const char* name, std::string* data);
|
|
|
|
private:
|
|
// Certificate and offline licenses are now stored in security
|
|
// level specific directories. In an earlier version they were
|
|
// stored in a common directory and need to be copied over.
|
|
virtual void SecurityLevelPathBackwardCompatibility();
|
|
|
|
File* file_;
|
|
CdmSecurityLevel security_level_;
|
|
bool initialized_;
|
|
|
|
CORE_DISALLOW_COPY_AND_ASSIGN(DeviceFiles);
|
|
};
|
|
|
|
} // namespace wvcdm
|
|
|
|
#endif // CDM_BASE_DEVICE_FILES_H_
|