#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "components/policy/core/common/cloud/test/policy_builder.h"
#include "base/base64.h"
#include "base/notreached.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
#include "crypto/signature_creator.h"
em;
namespace policy {
const uint8_t kVerificationPrivateKey[] = …;
namespace {
const uint8_t kSigningKey[] = …;
const uint8_t kSigningKeySignature[] = …;
const uint8_t kSigningKeySignatureForChild[] = …;
const uint8_t kNewSigningKey[] = …;
const uint8_t kNewSigningKeySignature[] = …;
const uint8_t kVerificationPublicKey[] = …;
const uint8_t kPublicKeyVerificationDataSignature[] = …;
const int32_t kNewPublicKeyVersion = …;
const char user_affiliation_id1[] = …;
const char user_affiliation_id2[] = …;
std::vector<uint8_t> ExportPublicKey(const crypto::RSAPrivateKey& key) { … }
std::string ConvertPublicKeyToString(const std::vector<uint8_t>& public_key) { … }
void SignData(const std::string& data,
crypto::RSAPrivateKey* const key,
std::string* const signature,
em::PolicyFetchRequest::SignatureType signature_type) { … }
}
const char PolicyBuilder::kFakeGaiaId[] = …;
const char PolicyBuilder::kFakeUsername[] = …;
const char PolicyBuilder::kFakeDeviceId[] = …;
const char PolicyBuilder::kFakeDomain[] = …;
const char PolicyBuilder::kFakeMachineName[] = …;
const char PolicyBuilder::kFakePolicyType[] = …;
const int PolicyBuilder::kFakePublicKeyVersion = …;
const int64_t PolicyBuilder::kFakeTimestamp = …;
const char PolicyBuilder::kFakeToken[] = …;
const char PolicyBuilder::kFakeServiceAccountIdentity[] = …;
PolicyBuilder::PolicyBuilder() { … }
PolicyBuilder::~PolicyBuilder() { … }
std::unique_ptr<crypto::RSAPrivateKey> PolicyBuilder::GetSigningKey() const { … }
void PolicyBuilder::SetSigningKey(const crypto::RSAPrivateKey& key) { … }
void PolicyBuilder::SetDefaultSigningKey() { … }
void PolicyBuilder::UnsetSigningKey() { … }
std::unique_ptr<crypto::RSAPrivateKey> PolicyBuilder::GetNewSigningKey() const { … }
void PolicyBuilder::SetDefaultNewSigningKey() { … }
void PolicyBuilder::UnsetNewSigningKey() { … }
void PolicyBuilder::SetDefaultInitialSigningKey() { … }
void PolicyBuilder::Build() { … }
std::string PolicyBuilder::GetBlob() const { … }
std::unique_ptr<em::PolicyFetchResponse> PolicyBuilder::GetCopy() const { … }
std::unique_ptr<crypto::RSAPrivateKey> PolicyBuilder::CreateTestSigningKey() { … }
std::unique_ptr<crypto::RSAPrivateKey>
PolicyBuilder::CreateTestOtherSigningKey() { … }
std::string PolicyBuilder::GetEncodedPolicyVerificationKey() { … }
std::string PolicyBuilder::GetPublicKeyVerificationDataSignature() { … }
std::string PolicyBuilder::GetTestSigningKeySignature() { … }
std::string PolicyBuilder::GetTestSigningKeySignatureForChild() { … }
std::string PolicyBuilder::GetTestOtherSigningKeySignature() { … }
std::vector<uint8_t> PolicyBuilder::GetPublicSigningKey() const { … }
std::vector<uint8_t> PolicyBuilder::GetPublicNewSigningKey() const { … }
std::vector<uint8_t> PolicyBuilder::GetPublicTestKey() { … }
std::vector<uint8_t> PolicyBuilder::GetPublicTestOtherKey() { … }
std::string PolicyBuilder::GetPublicSigningKeyAsString() const { … }
std::string PolicyBuilder::GetPublicNewSigningKeyAsString() const { … }
std::string PolicyBuilder::GetPublicTestKeyAsString() { … }
std::string PolicyBuilder::GetPublicTestOtherKeyAsString() { … }
std::vector<std::string> PolicyBuilder::GetUserAffiliationIds() { … }
AccountId PolicyBuilder::GetFakeAccountIdForTesting() { … }
void PolicyBuilder::SetSignatureType(
em::PolicyFetchRequest::SignatureType signature_type) { … }
template <>
TypedPolicyBuilder<em::CloudPolicySettings>::TypedPolicyBuilder()
: … { … }
template class TypedPolicyBuilder<em::CloudPolicySettings>;
#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
template <>
TypedPolicyBuilder<em::ExternalPolicyData>::TypedPolicyBuilder() { … }
template class TypedPolicyBuilder<em::ExternalPolicyData>;
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
StringPolicyBuilder::StringPolicyBuilder() = default;
void StringPolicyBuilder::Build() {
policy_data().set_policy_value(payload_);
PolicyBuilder::Build();
}
#endif
}