chromium/components/policy/test_support/signature_provider.cc

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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 {

// TODO(b:314810831, b:325026413): Update the signatures to match the key used
// for testing defined by PolicyBuilder, or update them to support the
// PublicKeyVerificationData type included in new_public_key_verification_data.
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) {}

}  // namespace

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 {}

}  // namespace policy