def test_clsag_invalid_Cp(self): res = self.gen_clsag_sig(ring_size=11, index=5) msg, scalars, sc1, sI, sD, ring2, Cp = res with self.assertRaises(ValueError): Cp = crypto.point_add(Cp, crypto.scalarmult_base(crypto.sc_init(1))) mlsag2.verify_clsag(msg, scalars, sc1, sI, sD, ring2, Cp)
def test_clsag_invalid_P(self): res = self.gen_clsag_sig(ring_size=11, index=5) msg, scalars, sc1, sI, sD, ring2, Cp = res with self.assertRaises(ValueError): ring2[5].commitment = crypto.encodepoint( crypto.point_mul8(crypto.decodepoint(ring2[5].dest))) mlsag2.verify_clsag(msg, scalars, sc1, sI, sD, ring2, Cp)
def verify_monero_generated(self, clsag): msg = ubinascii.unhexlify(clsag["msg"]) sI = crypto.decodepoint(ubinascii.unhexlify(clsag["sI"])) sD = crypto.decodepoint(ubinascii.unhexlify(clsag["sD"])) sc1 = crypto.decodeint(ubinascii.unhexlify(clsag["sc1"])) Cout = crypto.decodepoint(ubinascii.unhexlify(clsag["cout"])) scalars = [ crypto.decodeint(ubinascii.unhexlify(x)) for x in clsag["ss"] ] ring = [] for e in clsag["ring"]: ring.append( TmpKey(ubinascii.unhexlify(e[0]), ubinascii.unhexlify(e[1]))) mlsag2.verify_clsag(msg, scalars, sc1, sI, sD, ring, Cout)
def test_clsag_invalid_index(self): res = self.gen_clsag_sig(ring_size=11, index=5) msg, scalars, sc1, sI, sD, ring2, Cp = res with self.assertRaises(ValueError): ring2[5], ring2[6] = ring2[6], ring2[5] mlsag2.verify_clsag(msg, scalars, sc1, sI, sD, ring2, Cp)
def test_clsag_invalid_sD(self): res = self.gen_clsag_sig(ring_size=11, index=5) msg, scalars, sc1, sI, sD, ring2, Cp = res with self.assertRaises(ValueError): sD = crypto.scalarmult_base(crypto.random_scalar()) mlsag2.verify_clsag(msg, scalars, sc1, sI, sD, ring2, Cp)
def test_clsag_invalid_sI(self): res = self.gen_clsag_sig(ring_size=11, index=5) msg, scalars, sc1, sI, sD, ring2, Cp = res with self.assertRaises(ValueError): sI = crypto.point_mul8(sI) mlsag2.verify_clsag(msg, scalars, sc1, sI, sD, ring2, Cp)
def gen_clsag_test(self, ring_size=11, index=None): res = self.gen_clsag_sig(ring_size=11, index=index) msg, scalars, sc1, sI, sD, ring2, Cp = res mlsag2.verify_clsag(msg, scalars, sc1, sI, sD, ring2, Cp)