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