コード例 #1
0
ファイル: symcrypto_test.py プロジェクト: ztm1992/charm
 def testTamperMac(self):
     key = sha1(PairingGroup('SS512').random(GT))
     m = MessageAuthenticator(key)
     a = m.mac('hello world')
     m1 = MessageAuthenticator(key)
     a["digest"] = "tampered"
     assert not m1.verify(a), "expected message to verify"
コード例 #2
0
ファイル: symcrypto_test.py プロジェクト: FinalF/charm
 def testTamperMac(self):
     key = sha1(PairingGroup('SS512').random(GT))
     m = MessageAuthenticator(key)
     a = m.mac('hello world')
     m1 = MessageAuthenticator(key)
     a["digest"]= "tampered" 
     assert not m1.verify(a), "expected message to verify";
コード例 #3
0
ファイル: symcrypto_test.py プロジェクト: ztm1992/charm
 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"
コード例 #4
0
ファイル: symcrypto_test.py プロジェクト: FinalF/charm
 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";
コード例 #5
0
ファイル: symcrypto_test.py プロジェクト: ztm1992/charm
 def testSeperateVerify(self):
     key = sha1(PairingGroup('SS512').random(GT))
     m = MessageAuthenticator(key)
     a = m.mac('hello world')
     m1 = MessageAuthenticator(key)
     assert m1.verify(a), "expected message to verify"
コード例 #6
0
ファイル: symcrypto_test.py プロジェクト: FinalF/charm
 def testSeperateVerify(self):
     key = sha1(PairingGroup('SS512').random(GT))
     m = MessageAuthenticator(key)
     a = m.mac('hello world')
     m1 = MessageAuthenticator(key)
     assert m1.verify(a), "expected message to verify";