25 using Fq =
typename G1::Fq;
26 using Fr =
typename G1::Fr;
66 response = k - challenge_fr * secret_key;
82 if (!public_key.on_curve() || public_key.is_point_at_infinity())
87 if (R.is_point_at_infinity())
106 const std::string domain_separator_pop(
"h_reg");
109 std::vector<uint8_t> challenge_buf;
115 write(challenge_buf, G1::affine_one);
118 write(challenge_buf, public_key);
119 write(challenge_buf, public_key);
122 write(challenge_buf, R);
125 return Hash::hash(challenge_buf);
129template <
typename B,
typename G1,
typename Hash>
136template <
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()