view app/src/main/java/ch/ethz/ssh2/transport/ServerTransportManager.java @ 471:4f686f5a8b0f

Added tag stable-1.9.3-8 for changeset 2cc170e3fc9b
author Carl Byington <carl@five-ten-sg.com>
date Fri, 04 Oct 2019 17:13:10 -0700
parents d29cce60f393
children
line wrap: on
line source

package ch.ethz.ssh2.transport;

import java.io.IOException;
import java.net.Socket;

import ch.ethz.ssh2.server.ServerConnectionState;

/**
 * @version $Id: ServerTransportManager.java 151 2014-04-28 10:03:39Z dkocher@sudo.ch $
 */
public class ServerTransportManager extends TransportManager {

    private final Socket sock;

    public ServerTransportManager(final Socket socket) {
        super(socket);
        // TCP connection is already established
        this.sock = socket;
    }

    public void connect(ServerConnectionState state) throws IOException {
        /* Parse the client lin
        e and say hello - important: this information is later needed for the
         * key exchange (to stop man-in-the-middle attacks) - that is why we wrap it into an object
        * for later use.
        */
        state.csh = ClientServerHello.serverHello(state.softwareversion, sock.getInputStream(), sock.getOutputStream());
        TransportConnection tc = new TransportConnection(sock.getInputStream(), sock.getOutputStream(), state.generator);
        KexManager km = new ServerKexManager(state);
        super.init(tc, km);
        km.initiateKEX(state.next_cryptoWishList, null, state.next_dsa_key, state.next_rsa_key, state.next_ec_key);
        this.startReceiver();
    }
}