#include "components/policy/test_support/signature_provider.h"
#include <stdint.h>
#include <cstdint>
#include "base/base64.h"
#include "base/check.h"
#include "base/containers/span.h"
#include "base/hash/sha1.h"
#include "components/policy/core/common/cloud/test/policy_builder.h"
#include "components/policy/proto/device_management_backend.pb.h"
#include "crypto/rsa_private_key.h"
#include "crypto/signature_creator.h"
#include "device_management_backend.pb.h"
em;
namespace policy {
namespace {
constexpr char kSigningKey1[] = …;
constexpr char kSigningKey2[] = …;
constexpr char kTestDomain1Signature1[] = …;
constexpr char kTestDomain1Signature2[] = …;
constexpr char kTestDomain2Signature1[] = …;
constexpr char kTestDomain2Signature2[] = …;
constexpr char kTestDomain3Signature1[] = …;
constexpr char kTestDomain3Signature2[] = …;
constexpr char kWildCard[] = …;
std::unique_ptr<crypto::RSAPrivateKey> DecodePrivateKey(
const char* const encoded) { … }
bool ExportPublicKeyAsString(const crypto::RSAPrivateKey& private_key,
std::string* public_key) { … }
std::string Decode64(const std::string& str64) { … }
void InitSigningKeys(std::vector<SignatureProvider::SigningKey>* signing_keys) { … }
}
constexpr char SignatureProvider::kTestDomain1[];
constexpr char SignatureProvider::kTestDomain2[];
constexpr char SignatureProvider::kTestDomain3[];
SignatureProvider::SigningKey::SigningKey(
std::unique_ptr<crypto::RSAPrivateKey> private_key,
const std::map<std::string, std::string>& signatures)
: … { … }
SignatureProvider::SigningKey::SigningKey(
SignatureProvider::SigningKey&& signing_key) = default;
SignatureProvider::SigningKey& SignatureProvider::SigningKey::operator=(
SignatureProvider::SigningKey&& signing_key) = default;
SignatureProvider::SigningKey::~SigningKey() = default;
bool SignatureProvider::SigningKey::GetSignatureForDomain(
const std::string& domain,
std::string* signature) const { … }
bool SignatureProvider::SigningKey::Sign(
const std::string& str,
em::PolicyFetchRequest::SignatureType signature_type,
std::string* signature) const { … }
void SignatureProvider::SetUniversalSigningKeys() { … }
void SignatureProvider::SetSigningKeysForChildDomain() { … }
bool SignatureProvider::SignVerificationData(const std::string& data,
std::string* signature) const { … }
std::string SignatureProvider::GetVerificationPublicKey() { … }
SignatureProvider::SignatureProvider()
: … { … }
SignatureProvider::SignatureProvider(SignatureProvider&& signature_provider) =
default;
SignatureProvider& SignatureProvider::operator=(
SignatureProvider&& signature_provider) = default;
SignatureProvider::~SignatureProvider() = default;
const SignatureProvider::SigningKey* SignatureProvider::GetKeyByVersion(
int key_version) const { … }
const SignatureProvider::SigningKey* SignatureProvider::GetCurrentKey() const { … }
}