def ZKPU_verify(self, ch, G, r, c_bar, P_bar, m, pk, g): ''' verifies a ZKP for the correct format of a vote :param ch: the challenge :param G: the client side signing randomness :param r: the response :param c_bar: the blinded EV :param P_bar: the blinded pad :param m: the message (public attributes) :param pk: the public encryption key :param g: the public parameter from G1 :return: the result of the verification ''' return ZKP.verifyZKP_FormatU(ch, G, r, c_bar, P_bar, m, pk, g, self.params)
def testZKPU_oneParameter(self): groupObj = PairingGroup('BN254') params = 1 msg = [] msg.append("testmessage") msg_zkp = [] for i in range(0, params - 1): msg_zkp.append(msg[i]) el = ElGamal(params) agho = AGHOBlind(el) (pk_EV, sk_EV) = el.keygen() (c, o) = el.encrypt(pk_EV, msg) (c_bar, P_bar, G, e, f1, f2) = agho.blind(c, pk_EV['g']) (ch, r) = ZKP.ZKP_correctFormatU(pk_EV['g'], P_bar, pk_EV, o, e, G, f1, f2, params) isCorrect = ZKP.verifyZKP_FormatU(ch, G, r, c_bar, P_bar, msg_zkp, pk_EV, pk_EV['g'], params) assert (isCorrect) print("ZKPU Test Result with one parameter:", isCorrect)