using Renci.SshNet.Common;
namespace Renci.SshNet.Messages.Transport
{
///
/// Represents SSH_MSG_KEX_DH_GEX_INIT message.
///
[Message("SSH_MSG_KEX_DH_GEX_INIT", 32)]
internal class KeyExchangeDhGroupExchangeInit : 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 KeyExchangeDhGroupExchangeInit(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();
}
}
}