private void OptionDialog_Load(object sender, System.EventArgs args)
        {
            _options = (Options)Env.Options.Clone();

            //SSH
            string[] co = _options.CipherAlgorithmOrder;
            foreach (string c in co)
            {
                _cipherOrderList.Items.Add(c);
            }
            _hostKeyBox.SelectedIndex  = SSHUtil.ParsePublicKeyAlgorithm(_options.HostKeyAlgorithmOrder[0]) == PublicKeyAlgorithm.DSA? 0 : 1;          //これはDSA/RSAのどちらかしかない
            _windowSizeBox.Text        = _options.SSHWindowSize.ToString();
            _retainsPassphrase.Checked = _options.RetainsPassphrase;
            _sshCheckMAC.Checked       = _options.SSHCheckMAC;

            //接続
            _useSocks.Checked        = _options.UseSocks;
            _socksServerBox.Text     = _options.SocksServer;
            _socksPortBox.Text       = _options.SocksPort.ToString();
            _socksAccountBox.Text    = _options.SocksAccount;
            _socksPasswordBox.Text   = _options.SocksPassword;
            _socksNANetworksBox.Text = _options.SocksNANetworks;

            //一般
            _showInTaskBarOption.Checked       = _options.ShowInTaskBar;
            _warningOnExit.Checked             = _options.WarningOnExit;
            _optionPreservePlace.SelectedIndex = (int)_options.OptionPreservePlace;
            _languageBox.SelectedIndex         = (int)_options.Language;
        }
Exemple #2
0
        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"));
            }
        }
Exemple #3
0
        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"));
            }
        }