def test_hashAndVerify_with_invalid_signature(self): rsa = Python_RSAKey(self.N, self.e) sigBytes = bytearray(64) self.assertFalse( rsa.hashAndVerify(sigBytes, bytearray(b'text to sign')))
def test_hashAndVerify_without_NULL_encoding_of_SHA1(self): rsa = Python_RSAKey(self.N, self.e) sigBytes = bytearray( b'F\xe7\x8a>\x8a<;Cj\xdd\xea\x7f\x9d\x0c\xfd\xa7r\xd8\xa1O' + b'\xe1\xf5\x174\x0bR\xad:+\xc9C\x06\xf4\x88n\tp\x14FJ=\xfa' + b'\x8b\xefc\xe2\xdf\x00e\xc1\x1e\xe8\xd2\x97@\x8a\x96\xe2' + b'\x039Y_\x9c\xc9') self.assertTrue(rsa.hashAndVerify(sigBytes, bytearray(b'text to sign')))
def test_hashAndVerify(self): rsa = Python_RSAKey(self.N, self.e) sigBytes = bytearray( b'K\x7f\xf2\xca\x81\xf0A1\x95\xb1\x19\xe3\xd7QTL*Q|\xb6\x04' + b'\xbdG\x88H\x12\xc3\xe2\xb3\x97\xd2\xcd\xd8\xe8^Zn^\x8f\x1a' + b'\xae\x9a\x0b)\xb5K\xe8\x98|R\xac\xdc\xdc\n\x7f\x8b\xe7\xe6' + b'HQ\xc3hS\x19') self.assertTrue(rsa.hashAndVerify(sigBytes, bytearray(b'text to sign')))
def test_hashAndSign(self): rsa = Python_RSAKey(self.N, self.e, self.d, self.p, self.q, self.dP, self.dQ, self.qInv) sigBytes = rsa.hashAndSign(bytearray(b'text to sign')) self.assertEqual( bytearray( b'K\x7f\xf2\xca\x81\xf0A1\x95\xb1\x19\xe3\xd7QTL*Q|\xb6\x04' + b'\xbdG\x88H\x12\xc3\xe2\xb3\x97\xd2\xcd\xd8\xe8^Zn^\x8f\x1a' + b'\xae\x9a\x0b)\xb5K\xe8\x98|R\xac\xdc\xdc\n\x7f\x8b\xe7\xe6' + b'HQ\xc3hS\x19'), sigBytes)
def test___init___with_values(self): rsa = Python_RSAKey(self.N, self.e, self.d, self.p, self.q, self.dP, self.dQ, self.qInv) self.assertIsNotNone(rsa)
def test___init__(self): rsa = Python_RSAKey() self.assertIsNotNone(rsa)