KeyExchangeDhGroupExchangeRequest.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace Renci.SshNet.Messages.Transport
  6. {
  7. /// <summary>
  8. /// Represents SSH_MSG_KEX_DH_GEX_REQUEST message.
  9. /// </summary>
  10. [Message("SSH_MSG_KEX_DH_GEX_REQUEST", 34)]
  11. internal class KeyExchangeDhGroupExchangeRequest : Message, IKeyExchangedAllowed
  12. {
  13. /// <summary>
  14. /// Gets or sets the minimal size in bits of an acceptable group.
  15. /// </summary>
  16. /// <value>
  17. /// The minimum.
  18. /// </value>
  19. public UInt32 Minimum { get; private set; }
  20. /// <summary>
  21. /// Gets or sets the preferred size in bits of the group the server will send.
  22. /// </summary>
  23. /// <value>
  24. /// The preferred.
  25. /// </value>
  26. public UInt32 Preferred { get; private set; }
  27. /// <summary>
  28. /// Gets or sets the maximal size in bits of an acceptable group.
  29. /// </summary>
  30. /// <value>
  31. /// The maximum.
  32. /// </value>
  33. public UInt32 Maximum { get; private set; }
  34. /// <summary>
  35. /// Initializes a new instance of the <see cref="KeyExchangeDhGroupExchangeRequest"/> class.
  36. /// </summary>
  37. /// <param name="minimum">The minimum.</param>
  38. /// <param name="preferred">The preferred.</param>
  39. /// <param name="maximum">The maximum.</param>
  40. public KeyExchangeDhGroupExchangeRequest(uint minimum, uint preferred, uint maximum)
  41. {
  42. this.Minimum = minimum;
  43. this.Preferred = preferred;
  44. this.Maximum = maximum;
  45. }
  46. /// <summary>
  47. /// Called when type specific data need to be loaded.
  48. /// </summary>
  49. protected override void LoadData()
  50. {
  51. this.Minimum = this.ReadUInt32();
  52. this.Preferred = this.ReadUInt32();
  53. this.Maximum = this.ReadUInt32();
  54. }
  55. /// <summary>
  56. /// Called when type specific data need to be saved.
  57. /// </summary>
  58. protected override void SaveData()
  59. {
  60. this.Write(this.Minimum);
  61. this.Write(this.Preferred);
  62. this.Write(this.Maximum);
  63. }
  64. }
  65. }