def ZKPU(self, g, P_bar, pk, o, e, G, f1, f2): ''' calculates the ZKP for the correct format of the blinded EV :param g: the public parameter from G1 :param P_bar: the blinded pad :param pk: the verification key :param o: the secret client side encryption randomness :param e: secret parameter for pad blinding :param G: the client side signature randomness :param f1: first part of the random decomposition of the secret client signature parameter :param f2: second part of the random decomposition of the secret client signature parameter :return: the ZKP parameters challenge and response ''' (ch, r) = ZKP.ZKP_correctFormatU(g, P_bar, pk, o, e, G, f1, f2, self.params) return (ch, r)
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)