本文整理汇总了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();
}
}
示例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.");
}
示例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");
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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);
}
示例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();
}
示例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);
}
示例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();
}