#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "components/crx_file/crx_creator.h"
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "components/crx_file/crx3.pb.h"
#include "components/crx_file/crx_file.h"
#include "crypto/rsa_private_key.h"
#include "crypto/sha2.h"
#include "crypto/signature_creator.h"
namespace crx_file {
namespace {
std::string GetCrxId(const std::string& key) { … }
CreatorResult ReadAndSignArchive(base::File* file,
crypto::SignatureCreator* signer,
std::vector<uint8_t>* signature) { … }
bool WriteBuffer(base::File* file, const char buffer[], int len) { … }
bool WriteArchive(base::File* out, base::File* in) { … }
CreatorResult SignArchiveAndCreateHeader(const base::FilePath& output_path,
base::File* file,
crypto::RSAPrivateKey* signing_key,
CrxFileHeader* header) { … }
CreatorResult WriteCRX(const CrxFileHeader& header,
const base::FilePath& output_path,
base::File* file) { … }
}
CreatorResult CreateCrxWithVerifiedContentsInHeader(
const base::FilePath& output_path,
const base::FilePath& zip_path,
crypto::RSAPrivateKey* signing_key,
const std::string& verified_contents) { … }
CreatorResult Create(const base::FilePath& output_path,
const base::FilePath& zip_path,
crypto::RSAPrivateKey* signing_key) { … }
}