class InvalidMessageTest(BaseMessageTestCase): def setUp(self): self.channel = DummyAuthChannel(self.get_keyfile()) def test_empty_message(self): # Should not crash self.channel.handle_message(AuthenticatedMessage('source', '')) self.assertEqual(len(self.channel.sent_messages), 0)
def setUp(self): self.channel = DummyAuthChannel(self.get_keyfile()) # Send valid client_hello to get channel into correct state self.R_b = b'\x00'*8 msg = b'\x00\x10' + self.R_b response = self.send_with_mac(msg) self.R_a = response.msg[1:9]
def setUp(self): self.channel = DummyAuthChannel(self.get_keyfile()) # Put channel in established state self.R_b = b'\x00'*8 msg = b'\x00\x10' + self.R_b response = self.send_with_mac(msg, algo='sha3_256', length=8) self.R_a = response.msg[1:9] msg = b'\x01' + cbor.dumps({'macs': [self.mac], 'mac_len': self.mac_len}) mac = self.get_mac(msg, self.R_a, algo='sha3_256', length=8) self.get_response(msg + mac) self.session_key = HKDF(self.R_a + self.R_b, self.shared_secret).expand(b'1.0', length=16)
def setUp(self): self.channel = DummyAuthChannel(self.get_keyfile()) self.session = ClientSession('source', self.channel) self.session.do_client_hello() self.R_b = self.channel.sent_messages.pop(0).msg[2:-8] server_hello = b'\x80' + b'\x00' * 8 server_hello_mac = handshake_mac(self.shared_secret, server_hello, self.R_b) self.session_key = HKDF(b'\x00' * 8 + self.R_b, self.shared_secret).expand(info=b'1.0', length=16) self.session.handle(server_hello + server_hello_mac) self.sa_proposal = self.channel.sent_messages.pop(0).msg
def setUp(self): print('Starting general setup') self.channel = DummyAuthChannel(self.get_keyfile()) self.session = ClientSession('source', self.channel) self.session.do_client_hello() R_b = self.channel.sent_messages.pop(0).msg[2:-8] server_hello = b'\x80' + b'\x00' * 8 server_hello_mac = handshake_mac(self.shared_secret, server_hello, R_b) self.session.handle(server_hello + server_hello_mac) self.channel.sent_messages.pop(0) sa = b'\x81' + cbor.dumps({'mac': self.mac, 'mac_len': self.mac_len}) self.session_key = HKDF(b'\x00' * 8 + R_b, self.shared_secret).expand(info=b'1.0', length=16) sa_mac = handshake_mac(self.session_key, sa) self.session.handle(sa + sa_mac) print('Inbox on start: %s' % self.channel.sent_messages)
def setUp(self): self.channel = DummyAuthChannel(self.get_keyfile()) self.session = ClientSession('source', self.channel) self.session.do_client_hello() self.R_b = self.channel.sent_messages.pop(0).msg[2:-8]
def setUp(self): self.channel = DummyAuthChannel(self.get_keyfile()) self.session = ClientSession('source', self.channel)
def setUp(self): self.channel = DummyAuthChannel(self.get_keyfile())