chromium/chrome/browser/extensions/install_signer.cc

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

#include "chrome/browser/extensions/install_signer.h"

#include <stddef.h>
#include <stdint.h>

#include <memory>
#include <utility>

#include "base/base64.h"
#include "base/command_line.h"
#include "base/containers/to_value_list.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/json/values_util.h"
#include "base/stl_util.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/time/time.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/common/chrome_switches.h"
#include "crypto/random.h"
#include "crypto/secure_hash.h"
#include "crypto/sha2.h"
#include "crypto/signature_verifier.h"
#include "extensions/common/extension.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "rlz/buildflags/buildflags.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "url/gurl.h"

#if BUILDFLAG(ENABLE_RLZ)
#include "rlz/lib/machine_id.h"  // nogncheck crbug.com/1125897
#endif

namespace {

ExtensionIdSet;

const char kExpireDateKey[] =;
const char kExpiryKey[] =;
const char kHashKey[] =;
const char kIdsKey[] =;
const char kInvalidIdsKey[] =;
const char kProtocolVersionKey[] =;
const char kSaltKey[] =;
const char kSignatureKey[] =;
const char kSignatureFormatVersionKey[] =;
const char kTimestampKey[] =;

const char kContentTypeJSON[] =;

// This allows us to version the format of what we write into the prefs,
// allowing for forward migration, as well as detecting forwards/backwards
// incompatabilities, etc.
const int kSignatureFormatVersion =;

const size_t kSaltBytes =;

const char kBackendUrl[] =;

const char kPublicKeyPEM[] =;

GURL GetBackendUrl() {}

// Hashes |salt| with the machine id, base64-encodes it and returns it in
// |result|.
bool HashWithMachineId(const std::string& salt, std::string* result) {}

// Validates that |input| is a string of the form "YYYY-MM-DD".
bool ValidateExpireDateFormat(const std::string& input) {}

[[nodiscard]] std::optional<ExtensionIdSet> ExtensionIdSetFromList(
    const base::Value::List& list) {}

}  // namespace

namespace extensions {

InstallSignature::InstallSignature() = default;
InstallSignature::InstallSignature(const InstallSignature& other) = default;
InstallSignature::~InstallSignature() = default;

base::Value::Dict InstallSignature::ToDict() const {}

// static
std::unique_ptr<InstallSignature> InstallSignature::FromDict(
    const base::Value::Dict& dict) {}

InstallSigner::InstallSigner(
    scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
    const ExtensionIdSet& ids)
    :{}

InstallSigner::~InstallSigner() = default;

// static
bool InstallSigner::VerifySignature(const InstallSignature& signature) {}

// static
ExtensionIdSet InstallSigner::GetForcedNotFromWebstore() {}

void InstallSigner::GetSignature(SignatureCallback callback) {}

void InstallSigner::ReportErrorViaCallback() {}

void InstallSigner::ParseFetchResponse(
    std::unique_ptr<std::string> response_body) {}

void InstallSigner::HandleSignatureResult(const std::string& signature,
                                          const std::string& expire_date,
                                          const ExtensionIdSet& invalid_ids) {}

}  // namespace extensions