#ifndef __PRSONA_SERVER_ENTITY_HPP #define __PRSONA_SERVER_ENTITY_HPP #include #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& pi) const; Curvepoint get_blinding_generator( std::vector& pi, size_t which) const; Curvepoint get_fresh_generator() const; Curvepoint get_fresh_generator(size_t which) const; Curvepoint get_fresh_generator(std::vector& pi) const; Curvepoint get_fresh_generator( std::vector& 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 get_current_votes_by( Proof& pi, const Curvepoint& shortTermPublicKey) const; std::vector get_current_votes_by( Proof& pi, const Curvepoint& shortTermPublicKey, size_t which) const; std::vector> get_all_current_votes( Proof& pi) const; std::vector> 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 get_current_pseudonyms( Proof& pi) const; std::vector 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& pi, const std::vector& newVotes, const Curvepoint& shortTermPublicKey); bool receive_vote( const std::vector& pi, const std::vector& newVotes, const Curvepoint& shortTermPublicKey, size_t which); void transmit_new_user_data( const std::vector& 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 servers; // SCORE TALLYING std::vector tally_scores( const Curvepoint& nextGenerator, size_t which); // BINARY SEARCH size_t binary_search( const Curvepoint& shortTermPublicKey, size_t which) const; }; #endif