Files
android/libwvdrmengine/cdm/core/include/key_session.h
Fred Gylys-Colwell 8251aab9f6 Refactor key sessions to move them out of crypto session.
Merge from Widevine repo of http://go/wvgerrit/41833

Bug: 64003606
Test: in child CL

Change-Id: I3e1d36d0b0944dce0fb1515257bc15243d76f397
2018-01-30 00:04:36 -08:00

44 lines
1.6 KiB
C++

#ifndef WVCDM_CORE_KEY_SESSSION_H_
#define WVCDM_CORE_KEY_SESSSION_H_
#include "metrics_collections.h"
namespace wvcdm {
class CryptoKey;
class KeySession {
protected:
KeySession(metrics::CryptoMetrics* metrics) : metrics_(metrics) {}
public:
typedef enum { kDefault, kSubLicense } KeySessionType;
virtual ~KeySession() {}
virtual KeySessionType Type() = 0;
virtual bool GenerateDerivedKeys(const std::string& message) = 0;
virtual bool GenerateDerivedKeys(const std::string& message,
const std::string& session_key) = 0;
virtual OEMCryptoResult LoadKeys(const std::string& message,
const std::string& signature,
const std::string& mac_key_iv,
const std::string& mac_key,
const std::vector<CryptoKey>& keys,
const std::string& provider_session_token,
CdmCipherMode* cipher_mode,
const std::string& srm_requirement) = 0;
virtual OEMCryptoResult SelectKey(const std::string& key_id,
CdmCipherMode cipher_mode) = 0;
virtual OEMCryptoResult Decrypt(
const CdmDecryptionParameters& params,
OEMCrypto_DestBufferDesc& buffer_descriptor,
OEMCrypto_CENCEncryptPatternDesc& pattern_descriptor) = 0;
protected:
metrics::CryptoMetrics* metrics_;
};
typedef std::map<std::string, CryptoSessionId> SubLicenseSessionMap;
} // namespace wvcdm
#endif // WVCDM_CORE_KEY_SESSSION_H_