// 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_