#include "components/client_update_protocol/ecdsa.h"
#include <stdint.h>
#include "base/base64url.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "crypto/random.h"
#include "crypto/sha2.h"
#include "crypto/signature_verifier.h"
namespace client_update_protocol {
namespace {
std::vector<uint8_t> SHA256HashStr(const std::string_view& str) { … }
std::vector<uint8_t> SHA256HashVec(const std::vector<uint8_t>& vec) { … }
bool ParseETagHeader(const std::string_view& etag_header_value_in,
std::vector<uint8_t>* ecdsa_signature_out,
std::vector<uint8_t>* request_hash_out) { … }
}
Ecdsa::Ecdsa(int key_version, const std::string_view& public_key)
: … { … }
Ecdsa::~Ecdsa() = default;
std::unique_ptr<Ecdsa> Ecdsa::Create(int key_version,
const std::string_view& public_key) { … }
void Ecdsa::OverrideNonceForTesting(int key_version, uint32_t nonce) { … }
void Ecdsa::SignRequest(const std::string_view& request_body,
std::string* query_params) { … }
Ecdsa::RequestParameters Ecdsa::SignRequest(
const std::string_view& request_body) { … }
bool Ecdsa::ValidateResponse(const std::string_view& response_body,
const std::string_view& server_etag) { … }
}