1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- #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;
- std::vector<std::vector<CurveBipoint>> get_all_current_votes(
- Proof& pi) const;
- std::vector<std::vector<CurveBipoint>> get_all_current_votes(
- Proof& pi, size_t which) const;
- EGCiphertext get_current_user_encrypted_tally(
- Proof& pi, const Curvepoint& shortTermPublicKey) const;
- EGCiphertext get_current_user_encrypted_tally(
- Proof& pi, const Curvepoint& shortTermPublicKey, size_t which) const;
- TwistBipoint get_current_server_encrypted_tally(
- Proof& pi, const Curvepoint& shortTermPublicKey) const;
- TwistBipoint get_current_server_encrypted_tally(
- Proof& pi, const Curvepoint& shortTermPublicKey, size_t which) const;
- std::vector<Curvepoint> get_current_pseudonyms(
- Proof& pi) const;
- std::vector<Curvepoint> get_current_pseudonyms(
- Proof& pi, 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_new_user_data(
- const std::vector<Proof>& pi, PrsonaClient& newUser) const;
- 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);
- void print_scores() const;
- void print_votes() const;
- private:
- std::vector<PrsonaServer> servers;
- // SCORE TALLYING
- std::vector<EGCiphertext> tally_scores(
- const Curvepoint& nextGenerator,
- size_t which);
-
- // BINARY SEARCH
- size_t binary_search(
- const Curvepoint& shortTermPublicKey, size_t which) const;
- };
- #endif
|