| | | 1 | | namespace Renci.SshNet.Messages.Transport |
| | | 2 | | { |
| | | 3 | | /// <summary> |
| | | 4 | | /// Represents SSH_MSG_KEX_DH_GEX_REPLY message. |
| | | 5 | | /// </summary> |
| | | 6 | | [Message("SSH_MSG_KEX_DH_GEX_REPLY", MessageNumber)] |
| | | 7 | | internal sealed class KeyExchangeDhGroupExchangeReply : Message |
| | | 8 | | { |
| | | 9 | | internal const byte MessageNumber = 33; |
| | | 10 | | |
| | | 11 | | /// <summary> |
| | | 12 | | /// Gets server public host key and certificates. |
| | | 13 | | /// </summary> |
| | | 14 | | /// <value> |
| | | 15 | | /// The host key. |
| | | 16 | | /// </value> |
| | 18 | 17 | | public byte[] HostKey { get; private set; } |
| | | 18 | | |
| | | 19 | | /// <summary> |
| | | 20 | | /// Gets the F value. |
| | | 21 | | /// </summary> |
| | 18 | 22 | | public byte[] F { get; private set; } |
| | | 23 | | |
| | | 24 | | /// <summary> |
| | | 25 | | /// Gets the signature of H. |
| | | 26 | | /// </summary> |
| | | 27 | | /// <value>The signature.</value> |
| | 18 | 28 | | public byte[] Signature { get; private set; } |
| | | 29 | | |
| | | 30 | | /// <summary> |
| | | 31 | | /// Gets the size of the message in bytes. |
| | | 32 | | /// </summary> |
| | | 33 | | /// <value> |
| | | 34 | | /// The size of the messages in bytes. |
| | | 35 | | /// </value> |
| | | 36 | | protected override int BufferCapacity |
| | | 37 | | { |
| | | 38 | | get |
| | 0 | 39 | | { |
| | 0 | 40 | | var capacity = base.BufferCapacity; |
| | 0 | 41 | | capacity += 4; // HostKey length |
| | 0 | 42 | | capacity += HostKey.Length; // HostKey |
| | 0 | 43 | | capacity += 4; // F length |
| | 0 | 44 | | capacity += F.Length; // F |
| | 0 | 45 | | capacity += 4; // Signature length |
| | 0 | 46 | | capacity += Signature.Length; // Signature |
| | 0 | 47 | | return capacity; |
| | 0 | 48 | | } |
| | | 49 | | } |
| | | 50 | | |
| | | 51 | | /// <summary> |
| | | 52 | | /// Called when type specific data need to be loaded. |
| | | 53 | | /// </summary> |
| | | 54 | | protected override void LoadData() |
| | 9 | 55 | | { |
| | 9 | 56 | | HostKey = ReadBinary(); |
| | 9 | 57 | | F = ReadBinary(); |
| | 9 | 58 | | Signature = ReadBinary(); |
| | 9 | 59 | | } |
| | | 60 | | |
| | | 61 | | /// <summary> |
| | | 62 | | /// Called when type specific data need to be saved. |
| | | 63 | | /// </summary> |
| | | 64 | | protected override void SaveData() |
| | 0 | 65 | | { |
| | 0 | 66 | | WriteBinaryString(HostKey); |
| | 0 | 67 | | WriteBinaryString(F); |
| | 0 | 68 | | WriteBinaryString(Signature); |
| | 0 | 69 | | } |
| | | 70 | | |
| | | 71 | | internal override void Process(Session session) |
| | 6 | 72 | | { |
| | 6 | 73 | | session.OnKeyExchangeDhGroupExchangeReplyReceived(this); |
| | 6 | 74 | | } |
| | | 75 | | } |
| | | 76 | | } |