19 using Fq =
typename G1::Fq;
20 using Fr =
typename G1::Fr;
60 response = k - challenge_fr * secret_key;
76 if (!public_key.on_curve() || public_key.is_point_at_infinity())
81 if (R.is_point_at_infinity())
100 const std::string domain_separator_pop(
"h_reg");
103 std::vector<uint8_t> challenge_buf;
109 write(challenge_buf, G1::affine_one);
112 write(challenge_buf, public_key);
113 write(challenge_buf, public_key);
116 write(challenge_buf, R);
119 return Hash::hash(challenge_buf);
123template <
typename B,
typename G1,
typename Hash>
130template <
typename B,
typename G1,
typename Hash>
void read(B &it, SchnorrProofOfPossession< G1, Hash > &proof_of_possession)
void write(B &buf, SchnorrProofOfPossession< G1, Hash > const &proof_of_possession)
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
A proof of possession is a Schnorr proof of knowledge of a secret key corresponding to a given public...
typename G1::affine_element affine_element
SchnorrProofOfPossession()=default
static auto generate_challenge(const affine_element &public_key, const affine_element &R)
Generate the Fiat-Shamir challenge e = H_reg(G,X,X,R)
std::array< uint8_t, 32 > challenge
typename G1::element element
SchnorrProofOfPossession(const key_pair &account)
Create a new proof of possession for a given account.
bool verify(const affine_element &public_key) const
verifies that an unserialized signature is valid
G1::affine_element public_key
static field random_element(numeric::RNG *engine=nullptr) noexcept
static field serialize_from_buffer(const uint8_t *buffer)
static constexpr field zero()