private static SSHConnection ConnectMain(SSHConnectionParameter param, ISSHConnectionEventReceiver receiver, ProtocolNegotiationHandler pnh, AbstractSocket s)
        {
            pnh.Wait();

            if(pnh.State!=ReceiverState.Ready) throw new SSHException(pnh.ErrorMessage);

            string sv = pnh.ServerVersion;

            SSHConnection con = null;
            if(param.Protocol==SSHProtocol.SSH1)
                con = new SSH1Connection(param, receiver, sv, SSHUtil.ClientVersionString(param.Protocol));
            else
                con = new SSH2Connection(param, receiver, sv, SSHUtil.ClientVersionString(param.Protocol));

            s.SetHandler(con.PacketBuilder);
            SendMyVersion(s, param);

            if(con.Connect(s)!=AuthenticationResult.Failure)
                return con;
            else {
                s.Close();
                return null;
            }
        }
Example #2
0
 public KeyExchanger(SSH2Connection con, byte[] sessionID)
 {
     _con = con;
     _param = con.Param;
     _cInfo = (SSH2ConnectionInfo)con.ConnectionInfo;
     _sessionID = sessionID;
     _status = Status.INITIAL;
 }
Example #3
0
 internal CallbackSSH2PacketHandler(SSH2Connection con)
 {
     _connection = con;
 }