Bug: 8621588 Merge of the following CLs from the Widevine CDM repository: https://widevine-internal-review.googlesource.com/#/c/5602/ https://widevine-internal-review.googlesource.com/#/c/5431/ https://widevine-internal-review.googlesource.com/#/c/5660/ Change-Id: If37940e2535e1a1eca95e4394d8cf9bf689e9c3a
59 lines
2.2 KiB
C++
59 lines
2.2 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 DeviceFiles {
|
|
public:
|
|
typedef enum {
|
|
kLicenseStateActive,
|
|
kLicenseStateReleasing,
|
|
kLicenseStateUnknown,
|
|
} LicenseState;
|
|
|
|
static bool StoreCertificate(const std::string& certificate,
|
|
const std::string& wrapped_private_key);
|
|
static bool RetrieveCertificate(std::string* certificate,
|
|
std::string* wrapped_private_key);
|
|
|
|
static 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);
|
|
static 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);
|
|
static bool DeleteLicense(const std::string& key_set_id);
|
|
static bool LicenseExists(const std::string& key_set_id);
|
|
|
|
static std::string GetBasePath(const char* dir);
|
|
static const char* kBasePath;
|
|
static const char* kPathDelimiter;
|
|
static const char* kDeviceCertificateFileName;
|
|
static const char* kLicenseFileNameExt;
|
|
|
|
private:
|
|
static bool Hash(const std::string& data, std::string* hash);
|
|
static bool StoreFile(const char* name, const std::string& data);
|
|
static bool RetrieveFile(const char* name, std::string* data);
|
|
|
|
CORE_DISALLOW_COPY_AND_ASSIGN(DeviceFiles);
|
|
}; // namespace wvcdm
|
|
|
|
}
|
|
|
|
#endif // CDM_BASE_DEVICE_FILES_H_
|