protected override void Negotiate() { SSHConnectionParameter con = new SSHConnectionParameter(); con.Protocol = SSHProtocol.SSH2; con.UserName = _profile.SSHAccount; con.Password = _password; con.AuthenticationType = _profile.AuthType; con.IdentityFile = _profile.PrivateKeyFile; con.PreferableCipherAlgorithms = SSHUtil.ParseCipherAlgorithm(Env.Options.CipherAlgorithmOrder); con.PreferableHostKeyAlgorithms = SSHUtil.ParsePublicKeyAlgorithm(Env.Options.HostKeyAlgorithmOrder); con.WindowSize = Env.Options.SSHWindowSize; con.CheckMACError = Env.Options.SSHCheckMAC; if (_keycheck != null) { con.KeyCheck += new HostKeyCheckCallback(this.CheckKey); } _result = ChannelFactory.Create(_profile); SSHConnection c = SSHConnection.Connect(con, _result, _socket); c.AutoDisconnect = false; if (c != null) { /* * if(_profile.ProtocolType==ProtocolType.Udp) * OpenUdpDestination(c, (UdpChannelFactory)_result); * else */ _result.FixConnection(c); if (Env.Options.RetainsPassphrase) { _profile.Passphrase = _password; //接続成功時のみセット } } else { throw new IOException(Env.Strings.GetString("Message.ConnectionManager.ConnectionCancelled")); } }
protected override void Negotiate() { SSHConnectionParameter con = new SSHConnectionParameter(_host, _port, SSHProtocol.SSH2, _profile.AuthType, _profile.SSHAccount, _password); con.IdentityFile = _profile.PrivateKeyFile; con.PreferableCipherAlgorithms = SSHUtil.ParseCipherAlgorithm(Env.Options.CipherAlgorithmOrder); con.PreferableHostKeyAlgorithms = SSHUtil.ParsePublicKeyAlgorithm(Env.Options.HostKeyAlgorithmOrder); con.WindowSize = Env.Options.SSHWindowSize; con.CheckMACError = Env.Options.SSHCheckMAC; if (_keycheck != null) { con.VerifySSHHostKey = this.CheckKey; } _result = ChannelFactory.Create(_profile); ISSHConnection c = SSHConnection.Connect( _socket, con, sshconn => _result, null); if (c != null) { /* * if(_profile.ProtocolType==ProtocolType.Udp) * OpenUdpDestination(c, (UdpChannelFactory)_result); * else */ _result.FixConnection(c); if (Env.Options.RetainsPassphrase) { _profile.Passphrase = _password; //接続成功時のみセット } } else { throw new IOException(Env.Strings.GetString("Message.ConnectionManager.ConnectionCancelled")); } }