< Summary

Information
Class: Renci.SshNet.Messages.Transport.KeyExchangeDhGroupExchangeGroup
Assembly: Renci.SshNet
File(s): \home\appveyor\projects\ssh-net\src\Renci.SshNet\Messages\Transport\KeyExchangeDhGroupExchangeGroup.cs
Line coverage
42%
Covered lines: 9
Uncovered lines: 12
Coverable lines: 21
Total lines: 81
Line coverage: 42.8%
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_SafePrime()100%1100%
get_SubGroup()100%1100%
get_BufferCapacity()100%10%
LoadData()100%1100%
SaveData()100%10%
Process(...)100%1100%

File(s)

\home\appveyor\projects\ssh-net\src\Renci.SshNet\Messages\Transport\KeyExchangeDhGroupExchangeGroup.cs

#LineLine coverage
 1using Renci.SshNet.Common;
 2
 3namespace Renci.SshNet.Messages.Transport
 4{
 5    /// <summary>
 6    /// Represents SSH_MSG_KEX_DH_GEX_GROUP message.
 7    /// </summary>
 8    [Message("SSH_MSG_KEX_DH_GEX_GROUP", MessageNumber)]
 9    public class KeyExchangeDhGroupExchangeGroup : Message
 10    {
 11        internal const byte MessageNumber = 31;
 12
 13        private byte[] _safePrime;
 14        private byte[] _subGroup;
 15
 16        /// <summary>
 17        /// Gets the safe prime.
 18        /// </summary>
 19        /// <value>
 20        /// The safe prime.
 21        /// </value>
 22        public BigInteger SafePrime
 23        {
 1824            get { return _safePrime.ToBigInteger(); }
 25        }
 26
 27        /// <summary>
 28        /// Gets the generator for subgroup in GF(p).
 29        /// </summary>
 30        /// <value>
 31        /// The sub group.
 32        /// </value>
 33        public BigInteger SubGroup
 34        {
 1835            get { return _subGroup.ToBigInteger(); }
 36        }
 37
 38        /// <summary>
 39        /// Gets the size of the message in bytes.
 40        /// </summary>
 41        /// <value>
 42        /// The size of the messages in bytes.
 43        /// </value>
 44        protected override int BufferCapacity
 45        {
 46            get
 047            {
 048                var capacity = base.BufferCapacity;
 049                capacity += 4; // SafePrime length
 050                capacity += _safePrime.Length; // SafePrime
 051                capacity += 4; // SubGroup length
 052                capacity += _subGroup.Length; // SubGroup
 53
 054                return capacity;
 055            }
 56        }
 57
 58        /// <summary>
 59        /// Called when type specific data need to be loaded.
 60        /// </summary>
 61        protected override void LoadData()
 662        {
 663            _safePrime = ReadBinary();
 664            _subGroup = ReadBinary();
 665        }
 66
 67        /// <summary>
 68        /// Called when type specific data need to be saved.
 69        /// </summary>
 70        protected override void SaveData()
 071        {
 072            WriteBinaryString(_safePrime);
 073            WriteBinaryString(_subGroup);
 074        }
 75
 76        internal override void Process(Session session)
 677        {
 678            session.OnKeyExchangeDhGroupExchangeGroupReceived(this);
 679        }
 80    }
 81}