#ifndef __PRSONA_CLIENT_HPP #define __PRSONA_CLIENT_HPP #include #include #include "Curvepoint.hpp" #include "Scalar.hpp" #include "BGN.hpp" #include "base.hpp" #include "EGCiphertext.hpp" #include "proof.hpp" // Forward declaration to be able to make a pointer to the servers, // which is needed in some proofs class PrsonaServerEntity; class PrsonaClient : public PrsonaBase { public: // CONSTRUCTORS PrsonaClient( const std::vector& generatorProof, const Curvepoint& elGamalBlindGenerator, const BGNPublicKey& serverPublicKey, const PrsonaServerEntity* servers); // BASIC PUBLIC SYSTEM INFO GETTERS Curvepoint get_short_term_public_key() const; Curvepoint get_short_term_public_key(Proof &pi) const; // SERVER INTERACTIONS std::vector make_votes( std::vector& validVoteProof, const Proof& serverProof, const std::vector& oldEncryptedVotes, const std::vector& votes, const std::vector& replaces ) const; bool receive_fresh_generator( const std::vector& pi, const Curvepoint& freshGenerator); bool receive_vote_tally(); bool receive_new_user_data(const std::vector& pi); // REPUTATION PROOFS std::vector generate_reputation_proof( const Scalar& threshold ) const; bool verify_reputation_proof( const std::vector& pi, const Curvepoint& shortTermPublicKey, const Scalar& threshold ) const; // NEEDED FOR TESTING PROOFS Scalar get_score() const; private: // Constants for clients static bool SERVER_IS_MALICIOUS; static bool CLIENT_IS_MALICIOUS; // Things bound to the servers permanently const BGNPublicKey serverPublicKey; const PrsonaServerEntity *servers; // Things bound to the servers (but change regularly) Curvepoint currentFreshGenerator; // Things bound to this user permanently Scalar longTermPrivateKey; Scalar inversePrivateKey; // Things bound to this user (but change regularly) EGCiphertext currentEncryptedScore; Scalar currentScore; // Things related to making decryption more efficient std::unordered_map decryption_memoizer; Scalar max_checked; // SCORE DECRYPTION Scalar decrypt_score(const EGCiphertext& score); // OWNERSHIP OF STPK PROOFS Proof generate_ownership_proof() const; // VALID VOTE PROOFS std::vector generate_vote_proof( const std::vector& replaces, const std::vector& oldEncryptedVotes, const std::vector& newEncryptedVotes, const std::vector& seeds, const std::vector& votes ) const; }; #endif