| | | 1 | | namespace Renci.SshNet.Messages.Transport |
| | | 2 | | { |
| | | 3 | | /// <summary> |
| | | 4 | | /// Represents SSH_MSG_KEXECDH_REPLY message. |
| | | 5 | | /// </summary> |
| | | 6 | | [Message("SSH_MSG_KEX_ECDH_REPLY", 31)] |
| | | 7 | | public class KeyExchangeEcdhReplyMessage : Message |
| | | 8 | | { |
| | | 9 | | /// <summary> |
| | | 10 | | /// Gets a string encoding an X.509v3 certificate containing the server's ECDSA public host key. |
| | | 11 | | /// </summary> |
| | | 12 | | /// <value>The host key.</value> |
| | 2362 | 13 | | public byte[] KS { get; private set; } |
| | | 14 | | |
| | | 15 | | /// <summary> |
| | | 16 | | /// Gets the server's ephemeral contribution to the ECDH exchange, encoded as an octet string. |
| | | 17 | | /// </summary> |
| | 2362 | 18 | | public byte[] QS { get; private set; } |
| | | 19 | | |
| | | 20 | | /// <summary> |
| | | 21 | | /// Gets an octet string containing the server's signature of the newly established exchange hash value. |
| | | 22 | | /// </summary> |
| | | 23 | | /// <value>The signature.</value> |
| | 2362 | 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; // KS length |
| | 0 | 38 | | capacity += KS.Length; // KS |
| | 0 | 39 | | capacity += 4; // QS length |
| | 0 | 40 | | capacity += QS.Length; // QS |
| | 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() |
| | 1181 | 51 | | { |
| | 1181 | 52 | | KS = ReadBinary(); |
| | 1181 | 53 | | QS = ReadBinary(); |
| | 1181 | 54 | | Signature = ReadBinary(); |
| | 1181 | 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(KS); |
| | 0 | 63 | | WriteBinaryString(QS); |
| | 0 | 64 | | WriteBinaryString(Signature); |
| | 0 | 65 | | } |
| | | 66 | | |
| | | 67 | | internal override void Process(Session session) |
| | 1181 | 68 | | { |
| | 1181 | 69 | | session.OnKeyExchangeEcdhReplyMessageReceived(this); |
| | 1180 | 70 | | } |
| | | 71 | | } |
| | | 72 | | } |