Example #1
0
 def test_sign(self):
     sig = Crypto.sign(b"test", self.key)
     assert_equal(bytes, sig.__class__)
     sig2 = Crypto.sign(b"tesa", self.key)
     assert_equal(bytes, sig2.__class__)
     assert_not_equal(
         sig, sig2,
         'signatures for two different strings should return different values'
     )
Example #2
0
 def test_verify_fail_wrong_signature(self):
     sig = Crypto.sign(self.message, self.wrong_key)
     assert_false(Crypto.verify(self.message + b"2", self.key, sig))
Example #3
0
 def test_verify(self):
     sig = Crypto.sign(self.message, self.key)
     assert_true(Crypto.verify(self.message, self.key, sig))