12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- #ifndef __PRSONA_SERVER_ENTITY_HPP
- #define __PRSONA_SERVER_ENTITY_HPP
- #include <vector>
- #include "client.hpp"
- #include "server.hpp"
- #include "proof.hpp"
- class PrsonaServerEntity {
- public:
- // CONSTRUCTORS
- PrsonaServerEntity(size_t numServers);
- // BASIC PUBLIC SYSTEM INFO GETTERS
- BGNPublicKey get_bgn_public_key() const;
- BGNPublicKey get_bgn_public_key(size_t which) const;
- Curvepoint get_blinding_generator() const;
- Curvepoint get_blinding_generator(size_t which) const;
- Curvepoint get_blinding_generator(std::vector<Proof>& pi) const;
- Curvepoint get_blinding_generator(
- std::vector<Proof>& pi, size_t which) const;
- Curvepoint get_fresh_generator() const;
- Curvepoint get_fresh_generator(size_t which) const;
- Curvepoint get_fresh_generator(std::vector<Proof>& pi) const;
- Curvepoint get_fresh_generator(
- std::vector<Proof>& pi, size_t which) const;
- size_t get_num_clients() const;
- size_t get_num_clients(size_t which) const;
- size_t get_num_servers() const;
- size_t get_num_servers(size_t which) const;
- // ENCRYPTED DATA GETTERS
- std::vector<CurveBipoint> get_current_votes_by(
- Proof& pi, const Curvepoint& shortTermPublicKey) const;
- std::vector<CurveBipoint> get_current_votes_by(
- Proof& pi, const Curvepoint& shortTermPublicKey, size_t which) const;
- EGCiphertext get_current_tally(
- Proof& pi, const Curvepoint& shortTermPublicKey) const;
- EGCiphertext get_current_tally(
- Proof& pi, const Curvepoint& shortTermPublicKey, size_t which) const;
- // CLIENT INTERACTIONS
- void add_new_client(PrsonaClient& newUser);
- void add_new_client(PrsonaClient& newUser, size_t which);
- bool receive_vote(
- const std::vector<Proof>& pi,
- const std::vector<CurveBipoint>& newVotes,
- const Curvepoint& shortTermPublicKey);
- bool receive_vote(
- const std::vector<Proof>& pi,
- const std::vector<CurveBipoint>& newVotes,
- const Curvepoint& shortTermPublicKey,
- size_t which);
- void transmit_updates(PrsonaClient& currUser) const;
- void transmit_updates(PrsonaClient& currUser, size_t which) const;
- // EPOCH
- void epoch(Proof& pi);
- void epoch(Proof& pi, size_t which);
- private:
- std::vector<PrsonaServer> servers;
- // SCORE TALLYING
- std::vector<EGCiphertext> tally_scores(
- std::vector<Proof>& tallyProofs,
- const Curvepoint& nextGenerator,
- size_t which);
-
- // BINARY SEARCH
- size_t binary_search(
- const Curvepoint& shortTermPublicKey, size_t which) const;
- };
- #endif
|