Beispiel #1
0
 def setUp(self):
     self.key = Crypto.generate_key()
     self.addr_port_pair = ('127.0.0.1', 35341)
     self.client = KnockClient(socket.AF_INET, self.addr_port_pair)
     self.server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
     self.server.bind(self.addr_port_pair)
     self.expected_time = int(time.time())
 def setUp(self):
     self.handler = KnockRequestHandler(Crypto.generate_key())
     self.req_invalid_knock_time = KnockRequest(0, 100)
     self.req_invalid_visit_duration = KnockRequest(0, 1000000)
     self.request_valid = KnockRequest.create(100)
 def test_invalid_key(self):
     assert_raises(ValueError, KnockRequestHandler, Crypto.generate_key()[:-1])
Beispiel #4
0
 def test_generate_key(self):
     key = Crypto.generate_key()
     assert_equals(Crypto.KEY_SIZE, len(key))
     assert_is_instance(key, bytes)