Re-purpose internal factory upload tool for AOSP

This tool was supposed to be used for internal debugging purpose on
Android devices. It already supports RKP uploading CSR format.

Extend this tool to support  Widevine uploading format: JSON csr
and make this format as default output for AOSP (non-GMS) partners.

A later change will move it to its own aosp/ directory.

Test: run "wv_factory_extraction_tool json_csr" on Pixel 9
Bug: 414642286
Change-Id: I9cf4e9696d32201cc1ad70b6bee7932f7126a4ba
This commit is contained in:
conglin
2025-06-09 23:25:13 +00:00
parent cbcb2124d0
commit 1f77085571
5 changed files with 168 additions and 43 deletions

View File

@@ -9,6 +9,7 @@
#include <cstddef>
#include <cstdint>
#include <map>
#include <memory>
#include <string>
#include <vector>
@@ -32,6 +33,7 @@ class WidevineProvisioner {
bool GenerateCertificateRequestV2(const std::vector<uint8_t>& challenge,
std::vector<uint8_t>* csr);
bool GetDeviceInfo(std::vector<uint8_t>& device_info);
bool GenerateWidevineUploadRequest(std::string& request);
private:
bool GenerateProtectedData(
@@ -48,6 +50,9 @@ class WidevineProvisioner {
bool GetDeviceInfoCommon(cppbor::Map& device_info_map);
bool TryAddVerifiedDeviceInfo(cppbor::Map& device_info_map);
bool GetDeviceInfoV2(cppbor::Map& device_info_map);
void PopulateDeviceInfoFromCborMap(
const cppbor::Map& device_info_map,
std::map<std::string, std::string>& request_map);
std::unique_ptr<OEMCryptoInterface> crypto_interface_;
};