TestCipher.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Microsoft.VisualStudio.TestTools.UnitTesting;
  6. using Renci.SshClient.Security;
  7. using Renci.SshClient.Tests.Properties;
  8. namespace Renci.SshClient.Tests.Security
  9. {
  10. [TestClass]
  11. public class TestCipher
  12. {
  13. [TestMethod]
  14. public void Test_Cipher_TripleDES_Connection()
  15. {
  16. var connectionInfo = new PasswordConnectionInfo(Resources.HOST, 22, Resources.USERNAME, Resources.PASSWORD);
  17. connectionInfo.Encryptions.Clear();
  18. connectionInfo.Encryptions.Add("3des-cbc", typeof(CipherTripleDES));
  19. using (var client = new SshClient(connectionInfo))
  20. {
  21. client.Connect();
  22. client.Disconnect();
  23. }
  24. }
  25. [TestMethod]
  26. public void Test_Cipher_AES128CBC_Connection()
  27. {
  28. var connectionInfo = new PasswordConnectionInfo(Resources.HOST, 22, Resources.USERNAME, Resources.PASSWORD);
  29. connectionInfo.Encryptions.Clear();
  30. connectionInfo.Encryptions.Add("aes128-cbc", typeof(CipherAES128CBC));
  31. using (var client = new SshClient(connectionInfo))
  32. {
  33. client.Connect();
  34. client.Disconnect();
  35. }
  36. }
  37. [TestMethod]
  38. public void Test_Cipher_AES192CBC_Connection()
  39. {
  40. var connectionInfo = new PasswordConnectionInfo(Resources.HOST, 22, Resources.USERNAME, Resources.PASSWORD);
  41. connectionInfo.Encryptions.Clear();
  42. connectionInfo.Encryptions.Add("aes192-cbc", typeof(CipherAES192CBC));
  43. using (var client = new SshClient(connectionInfo))
  44. {
  45. client.Connect();
  46. client.Disconnect();
  47. }
  48. }
  49. [TestMethod]
  50. public void Test_Cipher_AES256CBC_Connection()
  51. {
  52. var connectionInfo = new PasswordConnectionInfo(Resources.HOST, 22, Resources.USERNAME, Resources.PASSWORD);
  53. connectionInfo.Encryptions.Clear();
  54. connectionInfo.Encryptions.Add("aes256-cbc", typeof(CipherAES256CBC));
  55. using (var client = new SshClient(connectionInfo))
  56. {
  57. client.Connect();
  58. client.Disconnect();
  59. }
  60. }
  61. [TestMethod]
  62. public void Test_Cipher_TripleDES_Algorithm()
  63. {
  64. //var cipher = new CipherTripleDES();
  65. //cipher.Init();
  66. //cipher.Encrypt();
  67. //cipher.Decrypt();
  68. }
  69. }
  70. }