def test_signature_wrong(self): blob = '123456789' key_name, sig = signature.sign_blob(blob) sig = chr(ord(sig[0]) + 1) + sig[1:] cert = signature.get_x509_certificate_by_name( signature.get_own_public_certificates(), key_name) self.assertFalse(signature.check_signature(blob, cert, sig))
def test_signature_correct(self): blob = '123456789' key_name, sig = signature.sign_blob(blob) cert = signature.get_x509_certificate_by_name( signature.get_own_public_certificates(), key_name) self.assertTrue(signature.check_signature(blob, cert, sig))