using System; namespace Renci.SshNet.Messages.Authentication { /// /// Represents "keyboard-interactive" SSH_MSG_USERAUTH_REQUEST message. /// internal sealed class RequestMessageKeyboardInteractive : RequestMessage { /// /// Gets message language. /// public byte[] Language { get; private set; } /// /// Gets authentication sub methods. /// public byte[] SubMethods { 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; // Language length capacity += Language.Length; // Language capacity += 4; // SubMethods length capacity += SubMethods.Length; // SubMethods return capacity; } } /// /// Initializes a new instance of the class. /// /// Name of the service. /// Authentication username. public RequestMessageKeyboardInteractive(ServiceName serviceName, string username) : base(serviceName, username, "keyboard-interactive") { Language = Array.Empty(); SubMethods = Array.Empty(); } /// /// Called when type specific data need to be saved. /// protected override void SaveData() { base.SaveData(); WriteBinaryString(Language); WriteBinaryString(SubMethods); } } }