#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "components/web_package/test_support/signed_web_bundles/ecdsa_p256_key_pair.h"
#include "base/check_is_test.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "crypto/sha2.h"
#include "third_party/boringssl/src/include/openssl/ec_key.h"
#include "third_party/boringssl/src/include/openssl/ecdsa.h"
#include "third_party/boringssl/src/include/openssl/mem.h"
namespace web_package::test {
namespace {
constexpr std::string_view kEcdsaP256SHA256NonceForTestingOnly = …;
}
EcdsaP256KeyPair EcdsaP256KeyPair::CreateRandom(
bool produce_invalid_signature) { … }
EcdsaP256KeyPair::EcdsaP256KeyPair(
base::span<const uint8_t, EcdsaP256PublicKey::kLength> public_key_bytes,
base::span<const uint8_t, 32> private_key_bytes,
bool produce_invalid_signature)
: … { … }
EcdsaP256KeyPair::EcdsaP256KeyPair(const EcdsaP256KeyPair&) = default;
EcdsaP256KeyPair& EcdsaP256KeyPair::operator=(const EcdsaP256KeyPair&) =
default;
EcdsaP256KeyPair::EcdsaP256KeyPair(EcdsaP256KeyPair&&) noexcept = default;
EcdsaP256KeyPair& EcdsaP256KeyPair::operator=(EcdsaP256KeyPair&&) noexcept =
default;
EcdsaP256KeyPair::~EcdsaP256KeyPair() = default;
std::vector<uint8_t> SignMessage(base::span<const uint8_t> message,
const EcdsaP256KeyPair& key_pair) { … }
}