Create() public static method

public static Create ( Poderosa.PortForwarding.ChannelProfile prof ) : ChannelFactory
prof Poderosa.PortForwarding.ChannelProfile
return ChannelFactory
コード例 #1
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"));
            }
        }
コード例 #2
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"));
            }
        }