wv_factory_extraction_tool: extract provision 4.0 csr

Bug: 231677822
Test: adb shell wv_factory_extraction_tool csr
Change-Id: I9f21514b027261f1d69c24a4d2f54051ccaac9a5
This commit is contained in:
Robert Shih
2022-05-06 01:38:52 -07:00
parent 56d976fec6
commit 05878ffbe1
9 changed files with 923 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
// Copyright 2021 Google LLC. All Rights Reserved. This file and proprietary
// source code may only be used and distributed under the Widevine License
// Agreement.
#ifndef WIDEVINE_PROVISIONER_H_
#define WIDEVINE_PROVISIONER_H_
#include <cppbor.h>
#include <cstddef>
#include <cstdint>
#include <memory>
#include <string>
#include <vector>
#include "WidevineOemcryptoInterface.h"
namespace widevine {
class WidevineProvisioner {
public:
WidevineProvisioner();
WidevineProvisioner(const WidevineProvisioner&) = delete;
WidevineProvisioner& operator=(const WidevineProvisioner&) = delete;
virtual ~WidevineProvisioner() = default;
std::vector<uint8_t> GetBcc();
bool GenerateCertificateRequest(
bool testMode, const std::vector<uint8_t>& endpointEncCertChain,
std::vector<uint8_t>& deviceInfo, std::vector<uint8_t>& protectedData);
bool GetDeviceInfo(std::vector<uint8_t>& device_info);
private:
bool GenerateProtectedData(
bool test_mode,
const std::vector<uint8_t>& endpoint_encryption_cert_chain,
std::vector<uint8_t> bcc, std::vector<uint8_t>& protected_data) const;
bool ValidateAndExtractEekPubAndId(
bool test_mode,
const std::vector<uint8_t>& endpoint_encryption_cert_chain,
std::vector<uint8_t>* eek_pub, std::vector<uint8_t>* eek_id) const;
cppbor::Array BuildCertReqRecipients(const std::vector<uint8_t>& pubkey,
const std::vector<uint8_t>& kid) const;
void InitializeCryptoInterface();
std::unique_ptr<OEMCryptoInterface> crypto_interface_;
};
} // namespace widevine
#endif // WIDEVINE_PROVISIONER_H_