serverEntity.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef __PRSONA_SERVER_ENTITY_HPP
  2. #define __PRSONA_SERVER_ENTITY_HPP
  3. #include <vector>
  4. #include "client.hpp"
  5. #include "server.hpp"
  6. #include "proof.hpp"
  7. class PrsonaServerEntity {
  8. public:
  9. PrsonaServerEntity(size_t numServers);
  10. BGNPublicKey get_bgn_public_key() const;
  11. Curvepoint get_blinding_generator() const;
  12. Curvepoint get_fresh_generator(Proof& pi) const;
  13. Scalar decrypt(const CurveBipoint& input);
  14. std::vector<CurveBipoint> get_current_votes_by(Proof& pi, const Curvepoint& shortTermPublicKey) const;
  15. void add_new_client(PrsonaClient& newUser);
  16. void receive_vote(const Proof& pi, const std::vector<CurveBipoint>& votes, const Curvepoint& shortTermPublicKey);
  17. void epoch();
  18. void transmit_score(PrsonaClient& currUser) const;
  19. private:
  20. std::vector<PrsonaServer> servers;
  21. std::vector<EGCiphertext> encryptedTallies;
  22. std::vector<Proof> tallyProofs;
  23. EGCiphertext get_default_tally(Proof& pi, const Curvepoint& shortTermPublicKey) const;
  24. Proof generate_valid_default_tally_proof(const EGCiphertext& encryptedDefaultTally, const Scalar& lambda) const;
  25. Proof generate_epoch_round_one_proof(const Proof& pi1, const Proof& pi2) const;
  26. Proof generate_epoch_proof(const Proof& pi, const EGCiphertext& encryptedTally) const;
  27. EGCiphertext get_current_tally(Proof& pi, const Curvepoint& shortTermPublicKey) const;
  28. std::vector<Scalar> tally_scores(Proof& pi);
  29. size_t binary_search(const Curvepoint& index) const;
  30. };
  31. #endif