namespace Renci.SshNet.Messages.Authentication { /// /// Represents "password" SSH_MSG_USERAUTH_REQUEST message. /// internal class RequestMessagePassword : RequestMessage { /// /// Gets the name of the authentication method. /// /// /// The name of the method. /// public override string MethodName { get { return "password"; } } /// /// Gets authentication password. /// public byte[] Password { get; private set; } /// /// Gets new authentication password. /// public byte[] NewPassword { get; private set; } /// /// Initializes a new instance of the class. /// /// Name of the service. /// Authentication username. /// Authentication password. public RequestMessagePassword(ServiceName serviceName, string username, byte[] password) : base(serviceName, username) { this.Password = password; } /// /// Initializes a new instance of the class. /// /// Name of the service. /// Authentication username. /// Authentication password. /// New authentication password. public RequestMessagePassword(ServiceName serviceName, string username, byte[] password, byte[] newPassword) : this(serviceName, username, password) { this.NewPassword = newPassword; } /// /// Called when type specific data need to be saved. /// protected override void SaveData() { base.SaveData(); this.Write(this.NewPassword != null); this.Write((uint)this.Password.Length); this.Write(this.Password); if (this.NewPassword != null) { this.Write((uint)this.NewPassword.Length); this.Write(this.NewPassword); } } } }