Esempio n. 1
0
        public CiphertextElectionContext ElectionContext(ElectionDescription description, string elgamal_public_key, int number_of_guardians, int quorum)
        {
            var ctxt = new ElectionContextRequest()
            {
                description         = description,
                elgamal_public_key  = elgamal_public_key,
                number_of_guardians = number_of_guardians,
                quorum = quorum
            };

            return(PostRequest <CiphertextElectionContext, ElectionContextRequest>("/api/v1/election/context", ctxt));
        }
Esempio n. 2
0
        public PublishedPlaintextTally TallyDecrypt(CiphertextElectionContext context, ElectionDescription description, PublishedCiphertextTally encrypted_tally, Dictionary <string, TallyDecryptionShare> shares)
        {
            var ctxt = new DecryptTallyRequest()
            {
                context         = context,
                description     = description,
                encrypted_tally = encrypted_tally,
                shares          = shares
            };

            return(PostRequest <PublishedPlaintextTally, DecryptTallyRequest>("/api/v1/tally/decrypt", ctxt));
        }
Esempio n. 3
0
        public EncryptBallotsResponse BallotEncrypt(PlaintextBallot[] ballots, CiphertextElectionContext context, ElectionDescription description, string nonce, string seed_hash)
        {
            var ctxt = new EncryptBallotsRequest()
            {
                ballots     = ballots,
                context     = context,
                description = description,
                nonce       = nonce,
                seed_hash   = seed_hash
            };

            return(PostRequest <EncryptBallotsResponse, EncryptBallotsRequest>("/api/v1/ballot/encrypt", ctxt));
        }
Esempio n. 4
0
        public PublishedCiphertextTally TallyAppend(CiphertextAcceptedBallot[] ballots, CiphertextElectionContext context, ElectionDescription description, PublishedCiphertextTally encrypted_tally)
        {
            var ctxt = new AppendTallyRequest()
            {
                ballots         = ballots,
                context         = context,
                description     = description,
                encrypted_tally = encrypted_tally
            };

            return(PostRequest <PublishedCiphertextTally, AppendTallyRequest>("/api/v1/tally/append", ctxt));
        }
Esempio n. 5
0
        public PublishedCiphertextTally Tally(CiphertextAcceptedBallot[] ballots, CiphertextElectionContext context, ElectionDescription description)
        {
            var ctxt = new StartTallyRequest()
            {
                ballots     = ballots,
                context     = context,
                description = description
            };

            return(PostRequest <PublishedCiphertextTally, StartTallyRequest>("/api/v1/tally", ctxt));
        }
Esempio n. 6
0
        public CiphertextAcceptedBallot BallotSpoil(CiphertextBallot ballot, CiphertextElectionContext context, ElectionDescription description)
        {
            var ctxt = new AcceptBallotRequest()
            {
                ballot      = ballot,
                context     = context,
                description = description
            };

            return(PostRequest <CiphertextAcceptedBallot, AcceptBallotRequest>("/api/v1/ballot/spoil", ctxt));
        }
Esempio n. 7
0
        public async Task <CiphertextAcceptedBallot> BallotSpoilAsync(CiphertextBallot ballot, CiphertextElectionContext context, ElectionDescription description)
        {
            var ctxt = new AcceptBallotRequest()
            {
                ballot      = ballot,
                context     = context,
                description = description
            };

            return(await PostRequestAsync <CiphertextAcceptedBallot, AcceptBallotRequest>("/api/v1/ballot/spoil", ctxt));
        }
Esempio n. 8
0
        public TallyDecryptionShare TallyDecryptShare(CiphertextElectionContext context, ElectionDescription description, PublishedCiphertextTally encrypted_tally, Guardian guardian)
        {
            var ctxt = new DecryptTallyShareRequest()
            {
                context         = context,
                description     = description,
                encrypted_tally = encrypted_tally,
                guardian        = guardian
            };

            return(PostRequest <TallyDecryptionShare, DecryptTallyShareRequest>("/api/v1/tally/decrypt-share", ctxt));
        }