Files
android/libwvdrmengine/cdm/core/include/key_session.h
Vicky Min 6577f6f212 Call CopyBuffer in Decrypt if key handle is empty
(Merged from go/wvgerrit/193672)

Bug: 320785945
Test: GTS + unit tests
Change-Id: I4a0c7568bf8323187f1156874ea98718511120f4
2024-03-15 14:50:02 -07:00

63 lines
2.6 KiB
C++

// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
// source code may only be used and distributed under the Widevine License
// Agreement.
#ifndef WVCDM_CORE_KEY_SESSION_H_
#define WVCDM_CORE_KEY_SESSION_H_
#include <vector>
#include "OEMCryptoCENC.h"
#include "metrics_collections.h"
#include "wv_cdm_types.h"
namespace wvcdm {
class CryptoKey;
class KeySession {
protected:
KeySession(metrics::CryptoMetrics* metrics) : metrics_(metrics) {}
public:
typedef enum { kDefault, kEntitlement } KeySessionType;
virtual ~KeySession() {}
virtual KeySessionType Type() = 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,
const std::string& srm_requirement) = 0;
virtual OEMCryptoResult LoadEntitledContentKeys(
const std::vector<CryptoKey>& keys) = 0;
virtual OEMCryptoResult SelectKey(const std::string& key_id,
CdmCipherMode cipher_mode) = 0;
virtual OEMCryptoResult Decrypt(
const OEMCrypto_SampleDescription* samples, size_t samples_length,
const OEMCrypto_CENCEncryptPatternDesc& pattern,
bool is_any_subsample_protected) = 0;
virtual OEMCryptoResult GenericEncrypt(const std::string& in_buffer,
const std::string& iv,
OEMCrypto_Algorithm algorithm,
std::string* out_buffer) = 0;
virtual OEMCryptoResult GenericDecrypt(const std::string& in_buffer,
const std::string& iv,
OEMCrypto_Algorithm algorithm,
std::string* out_buffer) = 0;
virtual OEMCryptoResult GenericSign(const std::string& message,
OEMCrypto_Algorithm algorithm,
std::string* signature) = 0;
virtual OEMCryptoResult GenericVerify(const std::string& message,
OEMCrypto_Algorithm algorithm,
const std::string& signature) = 0;
protected:
metrics::CryptoMetrics* metrics_;
};
} // namespace wvcdm
#endif // WVCDM_CORE_KEY_SESSION_H_