当前位置: 首页>>代码示例>>C#>>正文


C# PasswordConnectionInfo类代码示例

本文整理汇总了C#中PasswordConnectionInfo的典型用法代码示例。如果您正苦于以下问题:C# PasswordConnectionInfo类的具体用法?C# PasswordConnectionInfo怎么用?C# PasswordConnectionInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PasswordConnectionInfo类属于命名空间,在下文中一共展示了PasswordConnectionInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Test_KeyExchange_Rekeying

        public void Test_KeyExchange_Rekeying()
        {
            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, 22, Resources.USERNAME, Resources.PASSWORD);

            using (var client = new SshClient(connectionInfo))
            {
                client.Connect();
                //  TODO:   Add test to test re-keying
                Assert.Inconclusive();
                client.Disconnect();
            }
        }
开发者ID:nahidupa,项目名称:localtunnel-net-client,代码行数:12,代码来源:TestKeyExchange.cs

示例2: DisposeTest

 public void DisposeTest()
 {
     string host = string.Empty; // TODO: Initialize to an appropriate value
     string username = string.Empty; // TODO: Initialize to an appropriate value
     byte[] password = null; // TODO: Initialize to an appropriate value
     PasswordConnectionInfo target = new PasswordConnectionInfo(host, username, password); // TODO: Initialize to an appropriate value
     target.Dispose();
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
开发者ID:pecegit,项目名称:sshnet,代码行数:9,代码来源:PasswordConnectionInfoTest.cs

示例3: PasswordConnectionInfoConstructorTest10

 public void PasswordConnectionInfoConstructorTest10()
 {
     string host = string.Empty; // TODO: Initialize to an appropriate value
     string username = string.Empty; // TODO: Initialize to an appropriate value
     string password = string.Empty; // TODO: Initialize to an appropriate value
     ProxyTypes proxyType = new ProxyTypes(); // TODO: Initialize to an appropriate value
     string proxyHost = string.Empty; // TODO: Initialize to an appropriate value
     int proxyPort = 0; // TODO: Initialize to an appropriate value
     PasswordConnectionInfo target = new PasswordConnectionInfo(host, username, password, proxyType, proxyHost, proxyPort);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
开发者ID:pecegit,项目名称:sshnet,代码行数:11,代码来源:PasswordConnectionInfoTest.cs

示例4: Test_KeyExchange_GroupExchange_Sha256_Connection

        public void Test_KeyExchange_GroupExchange_Sha256_Connection()
        {
            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, 22, Resources.USERNAME, Resources.PASSWORD);
            connectionInfo.KeyExchangeAlgorithms.Clear();
            connectionInfo.KeyExchangeAlgorithms.Add("diffie-hellman-group-exchange-sha256", typeof(KeyExchangeDiffieHellmanGroupExchangeSha256));

            using (var client = new SshClient(connectionInfo))
            {
                client.Connect();
                client.Disconnect();
            }
        }
开发者ID:nahidupa,项目名称:localtunnel-net-client,代码行数:12,代码来源:TestKeyExchange.cs

示例5: Test_HMac_Sha256_Connection

        public void Test_HMac_Sha256_Connection()
        {
            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
            connectionInfo.HmacAlgorithms.Clear();
            connectionInfo.HmacAlgorithms.Add("hmac-sha2-256", new HashInfo(32 * 8, HashAlgorithmFactory.CreateHMACSHA256));

            using (var client = new SshClient(connectionInfo))
            {
                client.Connect();
                client.Disconnect();
            }
        }
开发者ID:REALTOBIZ,项目名称:SSH.NET,代码行数:12,代码来源:HMacTest.cs

示例6: Test_HMac_Sha1_Connection

        public void Test_HMac_Sha1_Connection()
        {
            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, 22, Resources.USERNAME, Resources.PASSWORD);
            connectionInfo.HmacAlgorithms.Clear();
            connectionInfo.HmacAlgorithms.Add("hmac-sha1", (key) => { return new HMac<SHA1Hash>(key.Take(20).ToArray()); });

            using (var client = new SshClient(connectionInfo))
            {
                client.Connect();
                client.Disconnect();
            }
        }
开发者ID:nahidupa,项目名称:localtunnel-net-client,代码行数:12,代码来源:TestHMac.cs

示例7: Test_HMac_Sha1_96_Connection

        public void Test_HMac_Sha1_96_Connection()
        {
            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
            connectionInfo.HmacAlgorithms.Clear();
            connectionInfo.HmacAlgorithms.Add("hmac-sha1", new HashInfo(20 * 8, key => CryptoAbstraction.CreateHMACSHA1(key, 96)));

            using (var client = new SshClient(connectionInfo))
            {
                client.Connect();
                client.Disconnect();
            }
        }
开发者ID:sshnet,项目名称:SSH.NET,代码行数:12,代码来源:HMacTest.cs

示例8: Test_Cipher_Aes192CTR_Connection

        public void Test_Cipher_Aes192CTR_Connection()
        {
            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, 22, Resources.USERNAME, Resources.PASSWORD);
            connectionInfo.Encryptions.Clear();
            connectionInfo.Encryptions.Add("aes192-ctr", new CipherInfo(192, (key, iv) => { return new AesCipher(key, new CtrCipherMode(iv), null); }));

            using (var client = new SshClient(connectionInfo))
            {
                client.Connect();
                client.Disconnect();
            }
        }
开发者ID:nahidupa,项目名称:localtunnel-net-client,代码行数:12,代码来源:TestCipher.cs

示例9: Test_HostKey_SshDss_Connection

        public void Test_HostKey_SshDss_Connection()
        {
            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
            connectionInfo.HostKeyAlgorithms.Clear();
            connectionInfo.HostKeyAlgorithms.Add("ssh-dss", (data) => { return new KeyHostAlgorithm("ssh-dss", new DsaKey(), data); });

            using (var client = new SshClient(connectionInfo))
            {
                client.Connect();
                client.Disconnect();
            }
        }
开发者ID:delfinof,项目名称:ssh.net,代码行数:12,代码来源:KeyHostAlgorithmTest.cs

示例10: Test_HMac_MD5_96_Connection

        public void Test_HMac_MD5_96_Connection()
        {
            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
            connectionInfo.HmacAlgorithms.Clear();
            connectionInfo.HmacAlgorithms.Add("hmac-md5", new HashInfo(16 * 8, key => HashAlgorithmFactory.CreateHMACMD5(key, 96)));

            using (var client = new SshClient(connectionInfo))
            {
                client.Connect();
                client.Disconnect();
            }
        }
开发者ID:REALTOBIZ,项目名称:SSH.NET,代码行数:12,代码来源:HMacTest.cs

示例11: Test_Cipher_AEes128CBC_Connection

        public void Test_Cipher_AEes128CBC_Connection()
        {
            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
            connectionInfo.Encryptions.Clear();
            connectionInfo.Encryptions.Add("aes128-cbc", new CipherInfo(128, (key, iv) => { return new AesCipher(key, new CbcCipherMode(iv), null); }));

            using (var client = new SshClient(connectionInfo))
            {
                client.Connect();
                client.Disconnect();
            }
        }
开发者ID:pecegit,项目名称:sshnet,代码行数:12,代码来源:AesCipherTest.cs

示例12: Test_PasswordConnectionInfo

        public void Test_PasswordConnectionInfo()
        {
            var host = Resources.HOST;
            var username = Resources.USERNAME;
            var password = Resources.PASSWORD;

            #region Example PasswordConnectionInfo
            var connectionInfo = new PasswordConnectionInfo(host, username, password);
            using (var client = new SftpClient(connectionInfo))
            {
                client.Connect();
                //  Do something here
                client.Disconnect();
            }
            #endregion

            Assert.AreEqual(connectionInfo.Host, Resources.HOST);
            Assert.AreEqual(connectionInfo.Username, Resources.USERNAME);
        }
开发者ID:delfinof,项目名称:ssh.net,代码行数:19,代码来源:PasswordConnectionInfoTest.cs

示例13: Test_Connect_Timeout

        public void Test_Connect_Timeout()
        {
            var host = Resources.HOST;
            var username = Resources.USERNAME;
            var password = Resources.PASSWORD;

            #region Example SshClient Connect Timeout
            var connectionInfo = new PasswordConnectionInfo(host, username, password);

            connectionInfo.Timeout = TimeSpan.FromSeconds(30);

            using (var client = new SshClient(connectionInfo))
            {
                client.Connect();
                //  Do something here
                client.Disconnect();
            }
            #endregion
            Assert.Inconclusive();
        }
开发者ID:delfinof,项目名称:ssh.net,代码行数:20,代码来源:SshClientTest.cs

示例14: Test_PasswordConnectionInfo_AuthenticationBanner

        public void Test_PasswordConnectionInfo_AuthenticationBanner()
        {
            var host = Resources.HOST;
            var username = Resources.USERNAME;
            var password = Resources.PASSWORD;

            #region Example PasswordConnectionInfo AuthenticationBanner
            var connectionInfo = new PasswordConnectionInfo(host, username, password);
            connectionInfo.AuthenticationBanner += delegate(object sender, AuthenticationBannerEventArgs e)
            {
                Console.WriteLine(e.BannerMessage);
            };
            using (var client = new SftpClient(connectionInfo))
            {
                client.Connect();
                //  Do something here
                client.Disconnect();
            }
            #endregion

            Assert.AreEqual(connectionInfo.Host, Resources.HOST);
            Assert.AreEqual(connectionInfo.Username, Resources.USERNAME);
        }
开发者ID:delfinof,项目名称:ssh.net,代码行数:23,代码来源:PasswordConnectionInfoTest.cs

示例15: Test_PasswordConnectionInfo_PasswordExpired

        public void Test_PasswordConnectionInfo_PasswordExpired()
        {
            var host = Resources.HOST;
            var username = Resources.USERNAME;
            var password = Resources.PASSWORD;

            #region Example PasswordConnectionInfo PasswordExpired
            var connectionInfo = new PasswordConnectionInfo("host", "username", "password");
            var encoding = new Renci.SshNet.Common.ASCIIEncoding();
            connectionInfo.PasswordExpired += delegate(object sender, AuthenticationPasswordChangeEventArgs e)
            {
                e.NewPassword = encoding.GetBytes("123456");
            };

            using (var client = new SshClient(connectionInfo))
            {
                client.Connect();

                client.Disconnect();
            }
            #endregion

            Assert.Inconclusive();
        }
开发者ID:delfinof,项目名称:ssh.net,代码行数:24,代码来源:PasswordConnectionInfoTest.cs


注:本文中的PasswordConnectionInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。