< Summary

Information
Class: Renci.SshNet.Security.Org.BouncyCastle.Crypto.KeyGenerationParameters
Assembly: Renci.SshNet
File(s): \home\appveyor\projects\ssh-net\src\Renci.SshNet\Security\BouncyCastle\crypto\KeyGenerationParameters.cs
Line coverage
76%
Covered lines: 10
Uncovered lines: 3
Coverable lines: 13
Total lines: 56
Line coverage: 76.9%
Branch coverage
50%
Covered branches: 2
Total branches: 4
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
.ctor(...)50%481.81%
get_Random()100%1100%
get_Strength()100%10%

File(s)

\home\appveyor\projects\ssh-net\src\Renci.SshNet\Security\BouncyCastle\crypto\KeyGenerationParameters.cs

#LineLine coverage
 1using System;
 2
 3using Renci.SshNet.Security.Org.BouncyCastle.Security;
 4
 5namespace Renci.SshNet.Security.Org.BouncyCastle.Crypto
 6{
 7    /**
 8     * The base class for parameters to key generators.
 9     */
 10    internal class KeyGenerationParameters
 11    {
 12        private SecureRandom  random;
 13        private int        strength;
 14
 15        /**
 16         * initialise the generator with a source of randomness
 17         * and a strength (in bits).
 18         *
 19         * @param random the random byte source.
 20         * @param strength the size, in bits, of the keys we want to produce.
 21         */
 922        public KeyGenerationParameters(
 923            SecureRandom  random,
 924            int        strength)
 925        {
 926      if (random == null)
 027        throw new ArgumentNullException("random");
 928      if (strength < 1)
 029        throw new ArgumentException("strength must be a positive value", "strength");
 30
 931      this.random = random;
 932            this.strength = strength;
 933        }
 34
 35    /**
 36         * return the random source associated with this
 37         * generator.
 38         *
 39         * @return the generators random source.
 40         */
 41        public SecureRandom Random
 42        {
 2743            get { return random; }
 44        }
 45
 46    /**
 47         * return the bit strength for keys produced by this generator,
 48         *
 49         * @return the strength of the keys this generator produces (in bits).
 50         */
 51        public int Strength
 52        {
 053            get { return strength; }
 54        }
 55    }
 56}