#include "components/web_package/test_support/signed_web_bundles/signature_verifier_test_utils.h"
#include "base/check_op.h"
#include "base/containers/map_util.h"
#include "base/functional/overloaded.h"
#include "base/notreached.h"
#include "base/numerics/byte_conversions.h"
#include "base/test/test_future.h"
#include "components/cbor/reader.h"
#include "components/cbor/writer.h"
#include "components/web_package/mojom/web_bundle_parser.mojom.h"
#include "components/web_package/signed_web_bundles/constants.h"
#include "components/web_package/signed_web_bundles/ecdsa_p256_public_key.h"
#include "components/web_package/signed_web_bundles/ed25519_public_key.h"
#include "components/web_package/signed_web_bundles/signed_web_bundle_signature_verifier.h"
#include "components/web_package/test_support/signed_web_bundles/web_bundle_signer.h"
namespace web_package::test {
namespace {
mojom::SignatureInfoPtr CreateSignatureInfo(
const Ed25519PublicKey& public_key,
base::span<const uint8_t> signature) { … }
mojom::SignatureInfoPtr CreateSignatureInfo(
const EcdsaP256PublicKey& public_key,
base::span<const uint8_t> signature) { … }
}
FakeSignatureVerifier::FakeSignatureVerifier(
std::optional<SignedWebBundleSignatureVerifier::Error> error,
base::RepeatingClosure on_verify_signatures)
: … { … }
FakeSignatureVerifier::~FakeSignatureVerifier() = default;
void FakeSignatureVerifier::VerifySignatures(
base::File file,
web_package::SignedWebBundleIntegrityBlock integrity_block,
SignatureVerificationCallback callback) const { … }
mojom::BundleIntegrityBlockSignatureStackEntryPtr MakeSignatureStackEntry(
const PublicKey& public_key,
base::span<const uint8_t> signature,
base::span<const uint8_t> attributes_cbor) { … }
SignedWebBundleIntegrityBlock ParseIntegrityBlockFromValue(
const cbor::Value& integrity_block) { … }
SignedWebBundleIntegrityBlock ParseIntegrityBlock(
base::span<const uint8_t> swbn) { … }
base::expected<void, SignedWebBundleSignatureVerifier::Error> VerifySignatures(
const SignedWebBundleSignatureVerifier& signature_verifier,
const base::File& file,
const SignedWebBundleIntegrityBlock& integrity_block) { … }
web_package::IntegrityBlockAttributes GetAttributesForSignedWebBundleId(
const std::string& signed_web_bundle_id) { … }
}