using Renci.SshNet.Common; namespace Renci.SshNet.Messages.Transport { /// /// Represents SSH_MSG_KEXDH_INIT message. /// [Message("SSH_MSG_KEXDH_INIT", 30)] internal class KeyExchangeDhInitMessage : Message, IKeyExchangedAllowed { private byte[] _eBytes; /// /// Gets the E value. /// public BigInteger E { get { return _eBytes.ToBigInteger(); } } /// /// 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; // E length capacity += _eBytes.Length; // E return capacity; } } /// /// Initializes a new instance of the class. /// /// The client exchange value. public KeyExchangeDhInitMessage(BigInteger clientExchangeValue) { _eBytes = clientExchangeValue.ToByteArray().Reverse(); } /// /// Called when type specific data need to be loaded. /// protected override void LoadData() { _eBytes = ReadBinary(); } /// /// Called when type specific data need to be saved. /// protected override void SaveData() { WriteBinaryString(_eBytes); } internal override void Process(Session session) { throw new System.NotImplementedException(); } } }