private string ConfigureSshConnection(IGuardedSecurity security) { this.sshProtocol = new SSHClient.Protocol(); this.sshProtocol.setTerminalParams(term.TerminalType, term.Rows, term.Columns); this.sshProtocol.OnDataIndicated += term.IndicateData; this.sshProtocol.OnDisconnect += this.OnDisconnected; term.OnDataRequested += this.sshProtocol.RequestData; String key = String.Empty; var options = this.Favorite.ProtocolProperties as SshOptions; KeyConfigElement keyConfigElement = this.Settings.SSHKeys.Keys[options.CertificateKey]; if (keyConfigElement != null) { key = keyConfigElement.Key; } this.sshProtocol.setProtocolParams(options.AuthMethod, security.UserName, security.Password, key, options.SSH1, options.SSHKeyFile); this.sshProtocol.Connect(client); this.connected = true; // SSH will throw if fails return((options.SSH1) ? "SSH1" : "SSH2"); }
private string ConfigureSshConnection(ISecurityOptions security) { this.sshProtocol = new SSHClient.Protocol(); this.sshProtocol.setTerminalParams(term.TerminalType, term.Rows, term.Columns); this.sshProtocol.OnDataIndicated += term.IndicateData; this.sshProtocol.OnDisconnect += this.OnDisconnected; term.OnDataRequested += this.sshProtocol.RequestData; String key = String.Empty; var options = this.Favorite.ProtocolProperties as SshOptions; SSHClient.KeyConfigElement keyConfigElement = Settings.Instance.SSHKeys.Keys[options.CertificateKey]; if (keyConfigElement != null) key = keyConfigElement.Key; this.sshProtocol.setProtocolParams(options.AuthMethod, security.UserName, security.Password, key, options.SSH1, options.SSHKeyFile); this.sshProtocol.Connect(client); this.connected = true; // SSH will throw if fails return (options.SSH1) ? "SSH1" : "SSH2"; }