client.hpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef __PRSONA_CLIENT_HPP
  2. #define __PRSONA_CLIENT_HPP
  3. #include <unordered_map>
  4. #include "Curvepoint.hpp"
  5. #include "Scalar.hpp"
  6. #include "BGN.hpp"
  7. class PrsonaClient {
  8. public:
  9. PrsonaClient(const BGNPublicKey& serverPublicKey, const Curvepoint& elGamalBlindGenerator);
  10. Curvepoint get_long_term_public_key() const;
  11. Curvepoint get_short_term_public_key() const;
  12. void receive_score(const Proof& pi, const EGCiphertext& score, const Scalar& newSeed);
  13. void make_votes(vector<CurveBipoint>& encryptedVotes, vector<Proof>& validVoteProofs, const vector<Scalar>& vote) const;
  14. Proof generate_reputation_proof() const;
  15. bool verify_reputation_proof(const Proof& pi, const Curvepoint& shortTermPublicKey) const;
  16. private:
  17. static const Curvepoint elGamalGenerator;
  18. const Curvepoint elGamalBlindGenerator;
  19. const BGNPublicKey serverPublicKey;
  20. Curvepoint currentFreshGenerator;
  21. EGCiphertext currentEncryptedScore;
  22. Scalar longTermPrivateKey;
  23. Scalar currentScore;
  24. Proof generate_vote_proof(const Scalar& vote) const;
  25. bool verify_score_proof(const Proof& pi) const;
  26. std::unordered_map<Curvepoint, Scalar, CurvepointHash> decryption_memoizer;
  27. Scalar max_checked;
  28. };
  29. #endif