< Summary

Information
Class: Renci.SshNet.Messages.Authentication.RequestMessageHost
Assembly: Renci.SshNet
File(s): \home\appveyor\projects\ssh-net\src\Renci.SshNet\Messages\Authentication\RequestMessageHost.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 35
Coverable lines: 35
Total lines: 104
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
get_PublicKeyAlgorithm()100%10%
get_PublicHostKey()100%10%
get_ClientHostName()100%10%
get_ClientUsername()100%10%
get_Signature()100%10%
get_BufferCapacity()100%10%
.ctor(...)100%10%
SaveData()100%10%

File(s)

\home\appveyor\projects\ssh-net\src\Renci.SshNet\Messages\Authentication\RequestMessageHost.cs

#LineLine coverage
 1namespace Renci.SshNet.Messages.Authentication
 2{
 3    /// <summary>
 4    /// Represents "hostbased" SSH_MSG_USERAUTH_REQUEST message.
 5    /// </summary>
 6    internal sealed class RequestMessageHost : RequestMessage
 7    {
 8        /// <summary>
 9        /// Gets the public key algorithm for host key as ASCII encoded byte array.
 10        /// </summary>
 011        public byte[] PublicKeyAlgorithm { get; }
 12
 13        /// <summary>
 14        /// Gets the public host key and certificates for client host.
 15        /// </summary>
 16        /// <value>
 17        /// The public host key.
 18        /// </value>
 019        public byte[] PublicHostKey { get; }
 20
 21        /// <summary>
 22        /// Gets the name of the client host as ASCII encoded byte array.
 23        /// </summary>
 24        /// <value>
 25        /// The name of the client host.
 26        /// </value>
 027        public byte[] ClientHostName { get; }
 28
 29        /// <summary>
 30        /// Gets the client username on the client host as UTF-8 encoded byte array.
 31        /// </summary>
 32        /// <value>
 33        /// The client username.
 34        /// </value>
 035        public byte[] ClientUsername { get; }
 36
 37        /// <summary>
 38        /// Gets the signature.
 39        /// </summary>
 40        /// <value>
 41        /// The signature.
 42        /// </value>
 043        public byte[] Signature { get; }
 44
 45        /// <summary>
 46        /// Gets the size of the message in bytes.
 47        /// </summary>
 48        /// <value>
 49        /// The size of the messages in bytes.
 50        /// </value>
 51        protected override int BufferCapacity
 52        {
 53            get
 054            {
 055                var capacity = base.BufferCapacity;
 056                capacity += 4; // PublicKeyAlgorithm length
 057                capacity += PublicKeyAlgorithm.Length; // PublicKeyAlgorithm
 058                capacity += 4; // PublicHostKey length
 059                capacity += PublicHostKey.Length; // PublicHostKey
 060                capacity += 4; // ClientHostName length
 061                capacity += ClientHostName.Length; // ClientHostName
 062                capacity += 4; // ClientUsername length
 063                capacity += ClientUsername.Length; // ClientUsername
 064                capacity += 4; // Signature length
 065                capacity += Signature.Length; // Signature
 066                return capacity;
 067            }
 68        }
 69
 70        /// <summary>
 71        /// Initializes a new instance of the <see cref="RequestMessageHost"/> class.
 72        /// </summary>
 73        /// <param name="serviceName">Name of the service.</param>
 74        /// <param name="username">Authentication username.</param>
 75        /// <param name="publicKeyAlgorithm">The public key algorithm.</param>
 76        /// <param name="publicHostKey">The public host key.</param>
 77        /// <param name="clientHostName">Name of the client host.</param>
 78        /// <param name="clientUsername">The client username.</param>
 79        /// <param name="signature">The signature.</param>
 80        public RequestMessageHost(ServiceName serviceName, string username, string publicKeyAlgorithm, byte[] publicHost
 081            : base(serviceName, username, "hostbased")
 082        {
 083            PublicKeyAlgorithm = Ascii.GetBytes(publicKeyAlgorithm);
 084            PublicHostKey = publicHostKey;
 085            ClientHostName = Ascii.GetBytes(clientHostName);
 086            ClientUsername = Utf8.GetBytes(clientUsername);
 087            Signature = signature;
 088        }
 89
 90        /// <summary>
 91        /// Called when type specific data need to be saved.
 92        /// </summary>
 93        protected override void SaveData()
 094        {
 095            base.SaveData();
 96
 097            WriteBinaryString(PublicKeyAlgorithm);
 098            WriteBinaryString(PublicHostKey);
 099            WriteBinaryString(ClientHostName);
 0100            WriteBinaryString(ClientUsername);
 0101            WriteBinaryString(Signature);
 0102        }
 103    }
 104}