< Summary

Information
Class: Renci.SshNet.Messages.Authentication.PublicKeyMessage
Assembly: Renci.SshNet
File(s): \home\appveyor\projects\ssh-net\src\Renci.SshNet\Messages\Authentication\PublicKeyMessage.cs
Line coverage
50%
Covered lines: 12
Uncovered lines: 12
Coverable lines: 24
Total lines: 70
Line coverage: 50%
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_PublicKeyAlgorithmName()100%1100%
get_PublicKeyData()100%1100%
get_BufferCapacity()100%10%
Process(...)100%1100%
LoadData()100%1100%
SaveData()100%10%
ToString()100%1100%

File(s)

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

#LineLine coverage
 1namespace Renci.SshNet.Messages.Authentication
 2{
 3    /// <summary>
 4    /// Represents SSH_MSG_USERAUTH_PK_OK message.
 5    /// </summary>
 6    [Message("SSH_MSG_USERAUTH_PK_OK", 60)]
 7    internal sealed class PublicKeyMessage : Message
 8    {
 9        /// <summary>
 10        /// Gets the name of the public key algorithm as ASCII encoded byte array.
 11        /// </summary>
 12        /// <value>
 13        /// The name of the public key algorithm.
 14        /// </value>
 135015        public byte[] PublicKeyAlgorithmName { get; private set; }
 16
 17        /// <summary>
 18        /// Gets the public key data.
 19        /// </summary>
 67520        public byte[] PublicKeyData { get; private set; }
 21
 22        /// <summary>
 23        /// Gets the size of the message in bytes.
 24        /// </summary>
 25        /// <value>
 26        /// The size of the messages in bytes.
 27        /// </value>
 28        protected override int BufferCapacity
 29        {
 30            get
 031            {
 032                var capacity = base.BufferCapacity;
 033                capacity += 4; // PublicKeyAlgorithmName length
 034                capacity += PublicKeyAlgorithmName.Length; // PublicKeyAlgorithmName
 035                capacity += 4; // PublicKeyData length
 036                capacity += PublicKeyData.Length; // PublicKeyData
 037                return capacity;
 038            }
 39        }
 40
 41        internal override void Process(Session session)
 67542        {
 67543            session.OnUserAuthenticationPublicKeyReceived(this);
 67544        }
 45
 46        /// <summary>
 47        /// Called when type specific data need to be loaded.
 48        /// </summary>
 49        protected override void LoadData()
 67550        {
 67551            PublicKeyAlgorithmName = ReadBinary();
 67552            PublicKeyData = ReadBinary();
 67553        }
 54
 55        /// <summary>
 56        /// Called when type specific data need to be saved.
 57        /// </summary>
 58        protected override void SaveData()
 059        {
 060            WriteBinaryString(PublicKeyAlgorithmName);
 061            WriteBinaryString(PublicKeyData);
 062        }
 63
 64        /// <inheritdoc/>
 65        public override string ToString()
 67566        {
 67567            return $"SSH_MSG_USERAUTH_PK_OK ({Ascii.GetString(PublicKeyAlgorithmName)})";
 67568        }
 69    }
 70}