12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #ifndef __PRSONA_SERVER_HPP
- #define __PRSONA_SERVER_HPP
- #include "BGN.hpp"
- #include "Curvepoint.hpp"
- #include "Bipoint.hpp"
- #include "EGCiphertext.hpp"
- class PrsonaServer : public BGN {
- public:
- PrsonaServer();
- Curvepoint get_blinding_generator() const;
- Curvepoint get_fresh_generator() const;
- Curvepoint add_new_client(const Curvepoint& longTermPublicKey);
- vector<EGCiphertext> epoch();
- void receive_vote(const Proof& pi, const vector<CurveBipoint>& votes, const Curvepoint& shortTermPublicKey);
- private:
- static const Curvepoint elGamalGenerator;
-
- Curvepoint elGamalBlindGenerator;
- Scalar currentSeed;
- vector<TwistBipoint> previousVoteTally;
- vector<Curvepoint> currentPseudonyms;
- /* each element represents a vote by <rowID>
- * applied to <colID> */
- vector<vector<CurveBipoint>> voteMatrix;
- template <typename T>
- void shuffle_vote_matrix(vector<T>& otherVector);
- void rerandomize_vote_matrix();
-
- size_t binary_search(const Curvepoint& index) const;
- bool verify_vote_proof(CurveBipoint vote, Proof pi, PrsonaPublicKey shortTermPublicKey);
- struct SortingType {
- Curvepoint pseudonym;
- size_t index;
- bool operator<( const SortingType& rhs ) const
- { return pseudonym < rhs.pseudonym; }
- }
- };
- #endif
|