#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" class PrsonaClient : public PrsonaBase { public: // CONSTRUCTORS PrsonaClient( const std::vector& generatorProof, const Twistpoint& elGamalBlindGenerator, const BGNPublicKey& serverPublicKey, size_t numServers); // BASIC PUBLIC SYSTEM INFO GETTERS Twistpoint get_short_term_public_key() const; Twistpoint get_short_term_public_key(Proof &pi) const; // SERVER INTERACTIONS std::vector make_votes( std::vector& validVoteProof, const std::vector& serverProof, const std::vector& oldEncryptedVotes, const std::vector& votes, const std::vector& replaces ) const; bool receive_fresh_generator( const std::vector& pi, const Twistpoint& freshGenerator); bool receive_vote_tally( const std::vector& pi, const EGCiphertext& score); bool receive_new_user_data( const std::vector& mainProof, const std::vector& serverEncryptedScoreProof, const CurveBipoint& serverEncryptedScore, const std::vector& userEncryptedScoreProof, const EGCiphertext& userEncryptedScore, const std::vector& voteMatrixProof, const std::vector>& encryptedVoteMatrix, const std::vector& pseudonymsProof, const std::vector& currentPseudonyms); // REPUTATION PROOFS std::vector generate_reputation_proof( const Scalar& threshold, size_t numClients ) const; bool verify_reputation_proof( const std::vector& pi, const Twistpoint& shortTermPublicKey, const Scalar& threshold, const std::vector& encryptedScoreProof, const EGCiphertext& encryptedScore ) const; // NEEDED FOR TESTING PROOFS Scalar get_score() const; private: // Things bound to the servers permanently const BGNPublicKey serverPublicKey; const size_t numServers; // Things bound to the servers (but change regularly) Twistpoint 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