public bool NegotiateAlgorithms(PacketKeyExchange client, PacketKeyExchange server) { algorithm_kex = NegotiateAlgorithm(client.kex_algorithms, server.kex_algorithms); algorithm_server_host_key = NegotiateAlgorithm(client.server_host_key_algorithms, server.server_host_key_algorithms); algorithm_encryption_client_to_server = NegotiateAlgorithm(client.encryption_algorithms_client_to_server, server.encryption_algorithms_client_to_server); algorithm_encryption_server_to_client = NegotiateAlgorithm(client.encryption_algorithms_server_to_client, server.encryption_algorithms_server_to_client); algorithm_mac_client_to_server = NegotiateAlgorithm(client.mac_algorithms_client_to_server, server.mac_algorithms_client_to_server); algorithm_mac_server_to_client = NegotiateAlgorithm(client.mac_algorithms_server_to_client, server.mac_algorithms_server_to_client); algorithm_compression_client_to_server = NegotiateAlgorithm(client.compression_algorithms_client_to_server, server.compression_algorithms_client_to_server); algorithm_compression_server_to_client = NegotiateAlgorithm(client.compression_algorithms_server_to_client, server.compression_algorithms_server_to_client); algorithm_languages_client_to_server = NegotiateAlgorithm(client.languages_client_to_server, server.languages_client_to_server); algorithm_languages_server_to_client = NegotiateAlgorithm(client.languages_server_to_client, server.languages_server_to_client); if (algorithm_kex != null && algorithm_server_host_key != null && algorithm_encryption_client_to_server != null && algorithm_encryption_server_to_client != null && algorithm_mac_client_to_server != null && algorithm_mac_server_to_client != null && algorithm_compression_client_to_server != null && algorithm_compression_server_to_client != null ) { return(true); } else { return(false); } }
// KeyExchange is a multibyte packet based action public void KeyExchangeInit() { // This Should Be a KeyExchange Packet Packet packet = RecvPacket(null); PacketKeyExchange packet_kex_server = new PacketKeyExchange(packet); packet_kex_server.Parse(); verify_i_s = packet_kex_server.GetPayload(); PacketKeyExchange packet_kex_client = new PacketKeyExchange(); packet_kex_client.Reset(); packet_kex_client.Pack(); verify_i_c = packet_kex_client.GetPayload(); SendPacket(null, packet_kex_client); NegotiateAlgorithms(packet_kex_client, packet_kex_server); }
public bool NegotiateAlgorithms(PacketKeyExchange client, PacketKeyExchange server) { algorithm_kex = NegotiateAlgorithm(client.kex_algorithms, server.kex_algorithms); algorithm_server_host_key = NegotiateAlgorithm(client.server_host_key_algorithms, server.server_host_key_algorithms); algorithm_encryption_client_to_server = NegotiateAlgorithm(client.encryption_algorithms_client_to_server, server.encryption_algorithms_client_to_server); algorithm_encryption_server_to_client = NegotiateAlgorithm(client.encryption_algorithms_server_to_client, server.encryption_algorithms_server_to_client); algorithm_mac_client_to_server = NegotiateAlgorithm(client.mac_algorithms_client_to_server, server.mac_algorithms_client_to_server); algorithm_mac_server_to_client = NegotiateAlgorithm(client.mac_algorithms_server_to_client, server.mac_algorithms_server_to_client); algorithm_compression_client_to_server = NegotiateAlgorithm(client.compression_algorithms_client_to_server, server.compression_algorithms_client_to_server); algorithm_compression_server_to_client = NegotiateAlgorithm(client.compression_algorithms_server_to_client, server.compression_algorithms_server_to_client); algorithm_languages_client_to_server = NegotiateAlgorithm(client.languages_client_to_server, server.languages_client_to_server); algorithm_languages_server_to_client = NegotiateAlgorithm(client.languages_server_to_client, server.languages_server_to_client); if (algorithm_kex != null && algorithm_server_host_key != null && algorithm_encryption_client_to_server != null && algorithm_encryption_server_to_client != null && algorithm_mac_client_to_server != null && algorithm_mac_server_to_client != null && algorithm_compression_client_to_server != null && algorithm_compression_server_to_client != null ) { return true; } else { return false; } }