Implement Cdm::listStoredLicenses()
[ Merge of http://go/wvgerrit/23600 ] This adds a new entry to IStorage:: - bool list(std::vector<std::string> file_names) It returns the name of each file in the (origin-specific) file system. b/34628115 Uses the current file system (origin-specific) bound to the CDM. Returns the list of stored licenses (key_set_ids) in vector output parameter. Test: verified by unittests on angler. Change-Id: I988556b27c2a4b75f52b59bcd78cfeaddd649acd
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#define WVCDM_CORE_CDM_ENGINE_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "certificate_provisioning.h"
|
||||
#include "clock.h"
|
||||
@@ -128,19 +129,29 @@ class CdmEngine {
|
||||
virtual CdmResponseType QueryOemCryptoSessionId(
|
||||
const CdmSessionId& session_id, CdmQueryMap* query_response);
|
||||
|
||||
// Provisioning related methods
|
||||
// Generate and return a valid provisioning request.
|
||||
virtual CdmResponseType GetProvisioningRequest(
|
||||
CdmCertificateType cert_type, const std::string& cert_authority,
|
||||
CdmProvisioningRequest* request, std::string* default_url);
|
||||
|
||||
// Verify and process a provisioning response.
|
||||
virtual CdmResponseType HandleProvisioningResponse(
|
||||
const CdmProvisioningResponse& response, std::string* cert,
|
||||
std::string* wrapped_key);
|
||||
|
||||
// Return true if there is a device certificate on the current
|
||||
// (origin-specific) file system.
|
||||
virtual bool IsProvisioned(CdmSecurityLevel security_level);
|
||||
|
||||
// Remove DRM certificate from the current (origin-specific)
|
||||
// file system. This will force the device to reprovision itself.
|
||||
virtual CdmResponseType Unprovision(CdmSecurityLevel security_level);
|
||||
|
||||
// Return the list of key_set_ids stored on the current (origin-specific)
|
||||
// file system.
|
||||
virtual CdmResponseType ListStoredLicenses(
|
||||
CdmSecurityLevel security_level, std::vector<std::string>* key_set_ids);
|
||||
|
||||
// Usage related methods for streaming licenses
|
||||
// Retrieve a random usage info from the list of all usage infos for this app
|
||||
// id.
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "crypto_session.h"
|
||||
#include "device_files.h"
|
||||
@@ -119,6 +120,7 @@ class CdmSession {
|
||||
// release the underlying crypto session) rather than call this method.
|
||||
virtual CdmResponseType ReleaseCrypto();
|
||||
|
||||
// Delete current license and matching usage record
|
||||
bool DeleteLicense();
|
||||
|
||||
// Generate unique ID for each new session.
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "device_files.pb.h"
|
||||
#include "scoped_ptr.h"
|
||||
@@ -78,6 +79,7 @@ class DeviceFiles {
|
||||
int64_t* grace_period_end_time, CdmAppParameterMap* app_parameters,
|
||||
std::string* usage_entry);
|
||||
virtual bool DeleteLicense(const std::string& key_set_id);
|
||||
virtual bool ListLicenses(std::vector<std::string>* key_set_ids);
|
||||
virtual bool DeleteAllFiles();
|
||||
virtual bool DeleteAllLicenses();
|
||||
virtual bool LicenseExists(const std::string& key_set_id);
|
||||
@@ -143,6 +145,7 @@ class DeviceFiles {
|
||||
bool RetrieveHashedFile(const std::string& name,
|
||||
video_widevine_client::sdk::File* file);
|
||||
bool FileExists(const std::string& name);
|
||||
bool ListFiles(std::vector<std::string>* names);
|
||||
bool RemoveFile(const std::string& name);
|
||||
ssize_t GetFileSize(const std::string& name);
|
||||
|
||||
|
||||
@@ -55,6 +55,11 @@ class FileSystem {
|
||||
virtual bool Remove(const std::string& file_path);
|
||||
virtual ssize_t FileSize(const std::string& file_path);
|
||||
|
||||
// Return the filenames stored at dir_path.
|
||||
// dir_path will be stripped from the returned names.
|
||||
virtual bool List(const std::string& dir_path,
|
||||
std::vector<std::string>* names);
|
||||
|
||||
const std::string& origin() const { return origin_; }
|
||||
void SetOrigin(const std::string& origin);
|
||||
|
||||
|
||||
@@ -271,6 +271,9 @@ enum CdmResponseType {
|
||||
SHRINK_USAGE_TABLER_HEADER_UNKNOWN_ERROR,
|
||||
MOVE_USAGE_ENTRY_UNKNOWN_ERROR,
|
||||
COPY_OLD_USAGE_ENTRY_UNKNOWN_ERROR,
|
||||
INVALID_PARAMETERS_ENG_22,
|
||||
STORE_LICENSE_ERROR_4, /* 235 */
|
||||
LIST_LICENSES_ERROR,
|
||||
};
|
||||
|
||||
enum CdmKeyStatus {
|
||||
|
||||
Reference in New Issue
Block a user