def testTamperAlg(self): key = sha1(PairingGroup('SS512').random(GT)) m = MessageAuthenticator(key) a = m.mac('hello world') m1 = MessageAuthenticator(key) m1._algorithm = "alg" # bypassing the algorithm check to verify the mac is over the alg + data a["alg"] = "alg" assert not m1.verify(a), "expected message to verify"
def testTamperAlg(self): key = sha1(PairingGroup('SS512').random(GT)) m = MessageAuthenticator(key) a = m.mac('hello world') m1 = MessageAuthenticator(key) m1._algorithm = "alg" # bypassing the algorithm check to verify the mac is over the alg + data a["alg"]= "alg" assert not m1.verify(a), "expected message to verify";