def _send_kex_init(self):
self.clear_to_send_lock.acquire()<EOL>try:<EOL><INDENT>self.clear_to_send.clear()<EOL><DEDENT>finally:<EOL><INDENT>self.clear_to_send_lock.release()<EOL><DEDENT>self.in_kex = True<EOL>if self.server_mode:<EOL><INDENT>if (self._modulus_pack is None) and ('<STR_LIT>' in self._preferred_kex):<EOL><INDENT>pkex = list(self.get_security_options().kex)<EOL>pkex.remove('<STR_LIT>')<EOL>self.get_security_options().kex = pkex<EOL><DEDENT>available_server_keys = list(filter(list(self.server_key_dict.keys()).__contains__,<EOL>self._preferred_keys))<EOL><DEDENT>else:<EOL><INDENT>available_server_keys = self._preferred_keys<EOL><DEDENT>m = Message()<EOL>m.add_byte(chr(MSG_KEXINIT))<EOL>m.add_bytes(rng.read(<NUM_LIT:16>))<EOL>m.add_list(self._preferred_kex)<EOL>m.add_list(available_server_keys)<EOL>m.add_list(self._preferred_ciphers)<EOL>m.add_list(self._preferred_ciphers)<EOL>m.add_list(self._preferred_macs)<EOL>m.add_list(self._preferred_macs)<EOL>m.add_list(self._preferred_compression)<EOL>m.add_list(self._preferred_compression)<EOL>m.add_string('<STR_LIT>')<EOL>m.add_string('<STR_LIT>')<EOL>m.add_boolean(False)<EOL>m.add_int(<NUM_LIT:0>)<EOL>self.local_kex_init = str(m)<EOL>self._send_message(m)<EOL>
announce to the other side that we'd like to negotiate keys, and what
kind of key negotiation we support.