// Copyright 2022 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_UPDATE_CLIENT_UNPACKER_H_ #define COMPONENTS_UPDATE_CLIENT_UNPACKER_H_ #include <stdint.h> #include <memory> #include <string> #include <vector> #include "base/files/file_path.h" #include "base/functional/callback.h" #include "base/memory/ref_counted.h" #include "base/sequence_checker.h" #include "components/update_client/update_client_errors.h" namespace crx_file { enum class VerifierFormat; } namespace update_client { class Unzipper; // Unpacks the component CRX package and verifies that it is // well formed and the cryptographic signature is correct. // // This class is only used by the component updater. It is inspired by // and overlaps with code in the extension's SandboxedUnpacker. // The main differences are: // - The public key hash is SHA256. // - Does not use a sandboxed unpacker. A valid component is fully trusted. // - The manifest can have different attributes and resources are not // transcoded. // // This is an updated version of Unpacker that leverages the new // Puffin-based puffpatch CRX-diff format, rather than the legacy // courgette/bsdiff per-file CRXD format. Puffin patches the CRX before // unpacking, changing the order of operations such that patching needs to occur // before verifying and unpacking. Unlike the original implementation, by the // time we unpack, the patching has already occurred. // // Note: During unzip step we also check for verified_contents.json in the // header of crx file and unpack it to metadata_ folder if it doesn't already // contain verified_contents file. class Unpacker : public base::RefCountedThreadSafe<Unpacker> { … }; } // namespace update_client #endif // COMPONENTS_UPDATE_CLIENT_UNPACKER_H_