1 package civitas.common.verifiablevote;
2
3 import org.springframework.beans.factory.annotation.Autowired;
4 import org.springframework.stereotype.Controller;
5
6 import civitas.crypto.ciphertextlist.CiphertextList;
7 import civitas.crypto.proof1ofl.VerifyElGamal1OfLReencryption;
8 import civitas.crypto.proofvote.VerifyProofVote;
9 import civitas.crypto.publickey.ElGamalPublicKey;
10
11 @Controller
12 public class VerifyVerifiableVote {
13 @Autowired
14 VerifyProofVote verifyProofVote;
15
16 @Autowired
17 VerifyElGamal1OfLReencryption verifyElGamal1OfLReencryption;
18
19 public boolean apply(
20 final VerifiableVote that, final ElGamalPublicKey pubKey, final CiphertextList ciphertexts, final int l) {
21 if (pubKey == null) {
22 return false;
23 }
24 return verifyElGamal1OfLReencryption.apply(that.encChoice(), pubKey, ciphertexts, l)
25 && verifyProofVote.apply(
26 that.proofVote(),
27 pubKey.params,
28 that.encCapability(),
29 that.encChoice().m(),
30 that.context());
31 }
32 }