Changes included in this CL: 166806: Update OEMCrypto_GetDeviceInformation() | https://widevine-internal-review.googlesource.com/c/cdm/+/166806 166808: Update Android L3 after OEMCrypto_GetDeviceInformation() signature changes | https://widevine-internal-review.googlesource.com/c/cdm/+/166808 166809: Decode device info and write it to CSR payload | https://widevine-internal-review.googlesource.com/c/cdm/+/166809 167158: Fix Android include path and copy_files | https://widevine-internal-review.googlesource.com/c/cdm/+/167158 167159: Fix common typos and use inclusive language suggested by Android linter | https://widevine-internal-review.googlesource.com/c/cdm/+/167159 165618: Explicitly state python3 where needed. | https://widevine-internal-review.googlesource.com/c/cdm/+/165618 166757: Update Android.bp for Android | https://widevine-internal-review.googlesource.com/c/cdm/+/166757 164993: Refactor basic oemcrypto unit tests | https://widevine-internal-review.googlesource.com/c/cdm/+/164993 164978: Update OEMCrypto Unit Test Docs | https://widevine-internal-review.googlesource.com/c/cdm/+/164978 166941: Update make files for OEMCrypto | https://widevine-internal-review.googlesource.com/c/cdm/+/166941 165279: Refactor license unit tests | https://widevine-internal-review.googlesource.com/c/cdm/+/165279 165318: Refactor provisioning unit tests | https://widevine-internal-review.googlesource.com/c/cdm/+/165318 164800: Add extra check for renew on license load unit test | https://widevine-internal-review.googlesource.com/c/cdm/+/164800 165860: Remove duplicate definition of MaybeHex() | https://widevine-internal-review.googlesource.com/c/cdm/+/165860 164889: Updated CoreCommonRequestFromMessage and fix test | https://widevine-internal-review.googlesource.com/c/cdm/+/164889 164967: Add OPK pre-hook and post-hook error codes | https://widevine-internal-review.googlesource.com/c/cdm/+/164967 165140: Add hidden device_id_length to v18 provisioning message | https://widevine-internal-review.googlesource.com/c/cdm/+/165140 165204: Fix memory leak in oemcrypto test | https://widevine-internal-review.googlesource.com/c/cdm/+/165204 165958: Fix oemcrypto_generic_verify_fuzz mutator signature offset | https://widevine-internal-review.googlesource.com/c/cdm/+/165958 166037: Support SHA-256 in OEMCrypto Session Util | https://widevine-internal-review.googlesource.com/c/cdm/+/166037 Test: Run GtsMediaTests on Pixel 7 Bug: 270612144 Change-Id: Iff0820a2de7d043a820470a130af65b0dcadb759
62 lines
2.0 KiB
C++
62 lines
2.0 KiB
C++
#ifndef CDM_OEMCRYPTO_SESSION_TESTS_HELPER_
|
|
#define CDM_OEMCRYPTO_SESSION_TESTS_HELPER_
|
|
|
|
#include <assert.h>
|
|
#include <openssl/aes.h>
|
|
#include <openssl/rand.h>
|
|
#include <algorithm>
|
|
#include <iostream>
|
|
|
|
#include "OEMCryptoCENC.h"
|
|
#include "oec_session_util.h"
|
|
#include "oec_test_data.h"
|
|
|
|
namespace wvoec {
|
|
|
|
class SessionUtil {
|
|
public:
|
|
SessionUtil()
|
|
: encoded_rsa_key_(kTestRSAPKCS8PrivateKeyInfo2_2048,
|
|
kTestRSAPKCS8PrivateKeyInfo2_2048 +
|
|
sizeof(kTestRSAPKCS8PrivateKeyInfo2_2048)) {}
|
|
|
|
// Create a new wrapped DRM Certificate. This creates a new one, even if one
|
|
// already exists. For provisioning 2 or 3, it uses encoded_rsa_key_ to
|
|
// specify the key. For Prov 4.0, the key is generated by OEMCrypto.
|
|
void CreateWrappedDRMKey();
|
|
|
|
// This is used to force installation of a keybox. This overwrites the
|
|
// production keybox -- it does NOT use OEMCrypto_LoadTestKeybox.
|
|
void InstallKeybox(const wvoec::WidevineKeybox& keybox, bool good);
|
|
|
|
// This loads the test keybox or the test RSA key, using LoadTestKeybox or
|
|
// LoadTestRSAKey as needed.
|
|
void EnsureTestROT();
|
|
|
|
// Install a DRM private key in to the session. If a key has not been created,
|
|
// tehn CreateWrappedDRMKey is used to create one first. Works with Prov 2-4.
|
|
void InstallTestDrmKey(Session* s);
|
|
|
|
// Create and install an OEM Cert private key. After creation, the key is
|
|
// saved to oem_public_key_. Only for provisioning 4.0
|
|
void CreateProv4OEMKey(Session* s);
|
|
|
|
// Create a new DRM Cert. Only for provisioning 4.0
|
|
void CreateProv4DRMKey();
|
|
|
|
// Used by prov2.0, prov3.0, and prov 4.0
|
|
std::vector<uint8_t> encoded_rsa_key_;
|
|
std::vector<uint8_t> wrapped_drm_key_;
|
|
OEMCrypto_PrivateKeyType drm_key_type_;
|
|
std::vector<uint8_t> drm_public_key_;
|
|
wvoec::WidevineKeybox keybox_;
|
|
|
|
// Used by prov4.0
|
|
std::vector<uint8_t> wrapped_oem_key_;
|
|
std::vector<uint8_t> oem_public_key_;
|
|
OEMCrypto_PrivateKeyType oem_key_type_;
|
|
};
|
|
|
|
} // namespace wvoec
|
|
#endif // CDM_OEMCRYPTO_SESSION_TESTS_HELPER_
|