2#include "../hashers/hashers.hpp"
3#include "barretenberg/ecc/curves/secp256k1/secp256k1.hpp"
5#include "barretenberg/ecc/curves/secp256r1/secp256r1.hpp"
7#include "barretenberg/serialize/msgpack.hpp"
13template <
typename Fr,
typename G1>
struct key_pair {
15 typename G1::affine_element public_key;
17 MSGPACK_FIELDS(private_key, public_key);
21 std::array<uint8_t, 32> r;
22 std::array<uint8_t, 32> s;
25 MSGPACK_FIELDS(r, s, v);
28template <
typename Hash,
typename Fq,
typename Fr,
typename G1>
31template <
typename Hash,
typename Fq,
typename Fr,
typename G1>
32typename G1::affine_element recover_public_key(
const std::string& message,
const signature& sig);
34template <
typename Hash,
typename Fq,
typename Fr,
typename G1>
35bool verify_signature(
const std::string& message,
36 const typename G1::affine_element& public_key,
41 return lhs.r == rhs.r && lhs.s == rhs.s && lhs.v == rhs.v;
44inline std::ostream& operator<<(std::ostream& os, signature
const& sig)
46 os <<
"{ " << sig.r <<
", " << sig.s <<
", " <<
static_cast<uint32_t
>(sig.v) <<
" }";
53#include "./ecdsa_impl.hpp"