12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- #ifndef __PRSONA_SERVER_ENTITY_HPP
- #define __PRSONA_SERVER_ENTITY_HPP
- #include <vector>
- #include "client.hpp"
- #include "server.hpp"
- #include "proof.hpp"
- class PrsonaServerEntity {
- public:
- PrsonaServerEntity(size_t numServers);
- BGNPublicKey get_bgn_public_key() const;
- Curvepoint get_blinding_generator() const;
- Curvepoint get_fresh_generator(Proof& pi) const;
- Scalar decrypt(const CurveBipoint& input);
- std::vector<CurveBipoint> get_current_votes_by(Proof& pi, const Curvepoint& shortTermPublicKey) const;
- void add_new_client(PrsonaClient& newUser);
- void receive_vote(const Proof& pi, const std::vector<CurveBipoint>& votes, const Curvepoint& shortTermPublicKey);
- void epoch();
- void transmit_score(PrsonaClient& currUser) const;
- private:
- std::vector<PrsonaServer> servers;
- std::vector<EGCiphertext> encryptedTallies;
- std::vector<Proof> tallyProofs;
- EGCiphertext get_default_tally(Proof& pi, const Curvepoint& shortTermPublicKey) const;
- Proof generate_valid_default_tally_proof(const EGCiphertext& encryptedDefaultTally, const Scalar& lambda) const;
- Proof generate_epoch_round_one_proof(const Proof& pi1, const Proof& pi2) const;
- Proof generate_epoch_proof(const Proof& pi, const EGCiphertext& encryptedTally) const;
- EGCiphertext get_current_tally(Proof& pi, const Curvepoint& shortTermPublicKey) const;
- std::vector<Scalar> tally_scores(Proof& pi);
- size_t binary_search(const Curvepoint& index) const;
- };
- #endif
|