#ifndef __PRSONA_CLIENT_HPP #define __PRSONA_CLIENT_HPP #include #include #include "Curvepoint.hpp" #include "Scalar.hpp" #include "BGN.hpp" #include "EGCiphertext.hpp" #include "proof.hpp" class PrsonaClient { public: PrsonaClient(const BGNPublicKey& serverPublicKey, const Curvepoint& elGamalBlindGenerator); static void set_malicious_server(); static void set_malicious_client(); Curvepoint get_short_term_public_key(Proof &pi) const; void make_votes(Proof& pi, std::vector& encryptedVotes, const std::vector& vote, const std::vector& replace) const; void receive_fresh_generator(const Proof& pi, const Curvepoint& freshGenerator); void receive_vote_tally(const Proof& pi, const EGCiphertext& score, bool isDefault); void receive_encrypted_votes(const Proof& pi, const std::vector& votes, bool isDefault); Proof generate_reputation_proof() const; bool verify_reputation_proof(const Proof& pi, const Curvepoint& shortTermPublicKey) const; private: static const Curvepoint elGamalGenerator; static bool malicious_server; static bool malicious_client; const BGNPublicKey serverPublicKey; const Curvepoint elGamalBlindGenerator; Curvepoint currentFreshGenerator; EGCiphertext currentEncryptedScore; Scalar longTermPrivateKey; Scalar currentScore; std::vector currEncryptedVotes; std::unordered_map decryption_memoizer; Scalar max_checked; void decrypt_score(const EGCiphertext& score); Proof generate_stpk_proof() const; bool verify_generator_proof(const Proof& pi, const Curvepoint& generator) const; bool verify_default_tally_proof(const Proof& pi, const EGCiphertext& generator) const; bool verify_valid_tally_proof(const Proof& pi, const EGCiphertext& score) const; bool verify_default_votes_proof(const Proof& pi, const std::vector& votes) const; bool verify_valid_votes_proof(const Proof& pi, const std::vector& votes) const; Proof generate_vote_proof(const std::vector& encryptedVotes, const std::vector& vote) const; bool verify_score_proof(const Proof& pi) const; }; #endif