package com.jscape.inet.ssh.protocol.v2.transport.keyexchange;

import com.jscape.inet.ssh.protocol.messages.Message;
import com.jscape.inet.ssh.protocol.v2.marshaling.ClientSession;
import com.jscape.util.net.connection.SyncMessageConnection;

/**
 * The SSH client key exchange operation.
 *
 * @author Alex Usun
 */
public interface ClientKeyExchange {

    /**
     * Performs actual key exchange.
     *
     * @param connection a transport connection
     * @param session a session instance
     * @param hostKeyVerificationService a server host key verification service
     *
     * @return a key exchange result
     *
     * @throws Exception if an error occurs
     */
    KeyExchangeResult exchangeKeys(SyncMessageConnection<Message> connection, ClientSession session, HostKeyVerificationService hostKeyVerificationService)
            throws Exception;

}
