2
0

IKeyExchange.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. using System;
  2. using System.Security.Cryptography;
  3. using Renci.SshNet.Common;
  4. using Renci.SshNet.Compression;
  5. using Renci.SshNet.Messages.Transport;
  6. using Renci.SshNet.Security.Cryptography;
  7. namespace Renci.SshNet.Security
  8. {
  9. /// <summary>
  10. /// Represents a key exchange algorithm.
  11. /// </summary>
  12. public interface IKeyExchange : IDisposable
  13. {
  14. /// <summary>
  15. /// Occurs when the host key is received.
  16. /// </summary>
  17. event EventHandler<HostKeyEventArgs> HostKeyReceived;
  18. /// <summary>
  19. /// Gets the name of the algorithm.
  20. /// </summary>
  21. /// <value>
  22. /// The name of the algorithm.
  23. /// </value>
  24. string Name { get; }
  25. /// <summary>
  26. /// Gets the exchange hash.
  27. /// </summary>
  28. /// <value>
  29. /// The exchange hash.
  30. /// </value>
  31. byte[] ExchangeHash { get; }
  32. /// <summary>
  33. /// Starts the key exchange algorithm.
  34. /// </summary>
  35. /// <param name="session">The session.</param>
  36. /// <param name="message">Key exchange init message.</param>
  37. void Start(Session session, KeyExchangeInitMessage message);
  38. /// <summary>
  39. /// Finishes the key exchange algorithm.
  40. /// </summary>
  41. void Finish();
  42. /// <summary>
  43. /// Creates the client-side cipher to use.
  44. /// </summary>
  45. /// <returns>
  46. /// The client cipher.
  47. /// </returns>
  48. Cipher CreateClientCipher();
  49. /// <summary>
  50. /// Creates the server-side cipher to use.
  51. /// </summary>
  52. /// <returns>
  53. /// The server cipher.
  54. /// </returns>
  55. Cipher CreateServerCipher();
  56. /// <summary>
  57. /// Creates the server-side hash algorithm to use.
  58. /// </summary>
  59. /// <returns>
  60. /// The server hash algorithm.
  61. /// </returns>
  62. HashAlgorithm CreateServerHash();
  63. /// <summary>
  64. /// Creates the client-side hash algorithm to use.
  65. /// </summary>
  66. /// <returns>
  67. /// The client hash algorithm.
  68. /// </returns>
  69. HashAlgorithm CreateClientHash();
  70. /// <summary>
  71. /// Creates the compression algorithm to use to deflate data.
  72. /// </summary>
  73. /// <returns>
  74. /// The compression method to deflate data.
  75. /// </returns>
  76. Compressor CreateCompressor();
  77. /// <summary>
  78. /// Creates the compression algorithm to use to inflate data.
  79. /// </summary>
  80. /// <returns>
  81. /// The compression method to inflate data.
  82. /// </returns>
  83. Compressor CreateDecompressor();
  84. }
  85. }