using Renci.SshNet.Common; namespace Renci.SshNet.Messages.Transport { /// /// Represents SSH_MSG_KEXDH_REPLY message. /// [Message("SSH_MSG_KEXDH_REPLY", 31)] public class KeyExchangeDhReplyMessage : Message { private byte[] _fBytes; /// /// Gets server public host key and certificates /// /// The host key. public byte[] HostKey { get; private set; } /// /// Gets the F value. /// public BigInteger F { get { return _fBytes.ToBigInteger(); } } /// /// Gets the signature of H. /// /// The signature. public byte[] Signature { get; private set; } /// /// Gets the size of the message in bytes. /// /// /// The size of the messages in bytes. /// protected override int BufferCapacity { get { var capacity = base.BufferCapacity; capacity += 4; // HostKey length capacity += HostKey.Length; // HostKey capacity += 4; // F length capacity += _fBytes.Length; // F capacity += 4; // Signature length capacity += Signature.Length; // Signature return capacity; } } /// /// Called when type specific data need to be loaded. /// protected override void LoadData() { HostKey = ReadBinary(); _fBytes = ReadBinary(); Signature = ReadBinary(); } /// /// Called when type specific data need to be saved. /// protected override void SaveData() { WriteBinaryString(HostKey); WriteBinaryString(_fBytes); WriteBinaryString(Signature); } internal override void Process(Session session) { session.OnKeyExchangeDhReplyMessageReceived(this); } } }