# < 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

Method | Branch coverage | Cyclomatic complexity | Line coverage
--- | --- | --- | ---
.ctor(...) | 50% | 4 | 81.81%
get_Random() | 100% | 1 | 100%
get_Strength() | 100% | 1 | 0%

# File(s)

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

| # | Line |  | Line coverage
--- | --- | --- | --- | ---
|  | `1` |  | `using System;`
|  | `2` |  | ``
|  | `3` |  | `using Renci.SshNet.Security.Org.BouncyCastle.Security;`
|  | `4` |  | ``
|  | `5` |  | `namespace 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` |  | `*/`
| 9 | `22` |  | `public KeyGenerationParameters(`
| 9 | `23` |  | `SecureRandom random,`
| 9 | `24` |  | `int strength)`
| 9 | `25` |  | `{`
| 9 | `26` |  | `if (random == null)`
| 0 | `27` |  | `throw new ArgumentNullException("random");`
| 9 | `28` |  | `if (strength < 1)`
| 0 | `29` |  | `throw new ArgumentException("strength must be a positive value", "strength");`
|  | `30` |  | ``
| 9 | `31` |  | `this.random = random;`
| 9 | `32` |  | `this.strength = strength;`
| 9 | `33` |  | `}`
|  | `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` |  | `{`
| 27 | `43` |  | `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` |  | `{`
| 0 | `53` |  | `get { return strength; }`
|  | `54` |  | `}`
|  | `55` |  | `}`
|  | `56` |  | `}`

# Methods/Properties

.ctor(Renci.SshNet.Security.Org.BouncyCastle.Security.SecureRandom,System.Int32)
get_Random()
get_Strength()