# < Summary

Information

Class: | Renci.SshNet.Security.Org.BouncyCastle.Asn1.Sec.SecNamedCurves
Assembly: | Renci.SshNet
File(s): | \home\appveyor\projects\ssh-net\src\Renci.SshNet\Security\BouncyCastle\asn1\sec\SECNamedCurves.cs

Line coverage
98%

Covered lines: | 54
Uncovered lines: | 1
Coverable lines: | 55
Total lines: | 121
Line coverage: | 98.1%

Branch coverage
83%

Covered branches: | 10
Total branches: | 12
Branch coverage: | 83.3%

Method coverage

Feature is only available for sponsors

Upgrade to PRO version

# Metrics

Method | Branch coverage | Cyclomatic complexity | Line coverage
--- | --- | --- | ---
.ctor() | 100% | 1 | 100%
.cctor() | 100% | 1 | 100%
CreateParameters() | 100% | 1 | 100%
.ctor() | 100% | 1 | 100%
.cctor() | 100% | 1 | 100%
CreateParameters() | 100% | 1 | 100%
.ctor() | 100% | 1 | 100%
.cctor() | 100% | 1 | 100%
CreateParameters() | 100% | 1 | 100%
GetByName(...) | 83.33% | 12 | 85.71%
FromHex(...) | 100% | 1 | 100%

# File(s)

## \home\appveyor\projects\ssh-net\src\Renci.SshNet\Security\BouncyCastle\asn1\sec\SECNamedCurves.cs

| # | Line |  | Line coverage
--- | --- | --- | --- | ---
|  | `1` |  | `using Renci.SshNet.Security.Org.BouncyCastle.Asn1.X9;`
|  | `2` |  | `using Renci.SshNet.Security.Org.BouncyCastle.Math;`
|  | `3` |  | `using Renci.SshNet.Security.Org.BouncyCastle.Math.EC;`
|  | `4` |  | `using Renci.SshNet.Security.Org.BouncyCastle.Utilities.Encoders;`
|  | `5` |  | ``
|  | `6` |  | `namespace Renci.SshNet.Security.Org.BouncyCastle.Asn1.Sec`
|  | `7` |  | `{`
|  | `8` |  | `internal sealed class SecNamedCurves`
|  | `9` |  | `{`
|  | `10` |  | `/*`
|  | `11` |  | `* secp256r1`
|  | `12` |  | `*/`
|  | `13` |  | `internal class Secp256r1Holder`
|  | `14` |  | `: X9ECParametersHolder`
|  | `15` |  | `{`
| 3 | `16` |  | `private Secp256r1Holder() {}`
|  | `17` |  | ``
| 1 | `18` |  | `internal static readonly X9ECParametersHolder Instance = new Secp256r1Holder();`
|  | `19` |  | ``
|  | `20` |  | `protected override X9ECParameters CreateParameters()`
| 1 | `21` |  | `{`
|  | `22` |  | `// p = 2^224 (2^32 - 1) + 2^192 + 2^96 - 1`
| 1 | `23` |  | `BigInteger p = FromHex("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF");`
| 1 | `24` |  | `BigInteger a = FromHex("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC");`
| 1 | `25` |  | `BigInteger b = FromHex("5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B");`
| 1 | `26` |  | `byte[] S = Hex.Decode("C49D360886E704936A6678E1139D26B7819F7E90");`
| 1 | `27` |  | `BigInteger n = FromHex("FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551");`
| 1 | `28` |  | `BigInteger h = BigInteger.One;`
|  | `29` |  | ``
| 1 | `30` |  | `ECCurve curve = new FpCurve(p, a, b, n, h);`
| 1 | `31` |  | `X9ECPoint G = new X9ECPoint(curve, Hex.Decode("04"`
| 1 | `32` |  | `+ "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296"`
| 1 | `33` |  | `+ "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5"));`
|  | `34` |  | ``
| 1 | `35` |  | `return new X9ECParameters(curve, G, n, h, S);`
| 1 | `36` |  | `}`
|  | `37` |  | `}`
|  | `38` |  | ``
|  | `39` |  | `/*`
|  | `40` |  | `* secp384r1`
|  | `41` |  | `*/`
|  | `42` |  | `internal class Secp384r1Holder`
|  | `43` |  | `: X9ECParametersHolder`
|  | `44` |  | `{`
| 3 | `45` |  | `private Secp384r1Holder() {}`
|  | `46` |  | ``
| 1 | `47` |  | `internal static readonly X9ECParametersHolder Instance = new Secp384r1Holder();`
|  | `48` |  | ``
|  | `49` |  | `protected override X9ECParameters CreateParameters()`
| 1 | `50` |  | `{`
|  | `51` |  | `// p = 2^384 - 2^128 - 2^96 + 2^32 - 1`
| 1 | `52` |  | `BigInteger p = FromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF00000000`
| 1 | `53` |  | `BigInteger a = FromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF00000000`
| 1 | `54` |  | `BigInteger b = FromHex("B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D`
| 1 | `55` |  | `byte[] S = Hex.Decode("A335926AA319A27A1D00896A6773A4827ACDAC73");`
| 1 | `56` |  | `BigInteger n = FromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77A`
| 1 | `57` |  | `BigInteger h = BigInteger.One;`
|  | `58` |  | ``
| 1 | `59` |  | `ECCurve curve = new FpCurve(p, a, b, n, h);`
| 1 | `60` |  | `X9ECPoint G = new X9ECPoint(curve, Hex.Decode("04"`
| 1 | `61` |  | `+ "AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7"`
| 1 | `62` |  | `+ "3617DE4A96262C6F5D9E98BF9292DC29F8F41DBD289A147CE9DA3113B5F0B8C00A60B1CE1D7E819D7A431D7C90EA0E5F"`
|  | `63` |  | ``
| 1 | `64` |  | `return new X9ECParameters(curve, G, n, h, S);`
| 1 | `65` |  | `}`
|  | `66` |  | `}`
|  | `67` |  | ``
|  | `68` |  | `/*`
|  | `69` |  | `* secp521r1`
|  | `70` |  | `*/`
|  | `71` |  | `internal class Secp521r1Holder`
|  | `72` |  | `: X9ECParametersHolder`
|  | `73` |  | `{`
| 3 | `74` |  | `private Secp521r1Holder() {}`
|  | `75` |  | ``
| 1 | `76` |  | `internal static readonly X9ECParametersHolder Instance = new Secp521r1Holder();`
|  | `77` |  | ``
|  | `78` |  | `protected override X9ECParameters CreateParameters()`
| 1 | `79` |  | `{`
|  | `80` |  | `// p = 2^521 - 1`
| 1 | `81` |  | `BigInteger p = FromHex("01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF`
| 1 | `82` |  | `BigInteger a = FromHex("01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF`
| 1 | `83` |  | `BigInteger b = FromHex("0051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E`
| 1 | `84` |  | `byte[] S = Hex.Decode("D09E8800291CB85396CC6717393284AAA0DA64BA");`
| 1 | `85` |  | `BigInteger n = FromHex("01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F`
| 1 | `86` |  | `BigInteger h = BigInteger.One;`
|  | `87` |  | ``
| 1 | `88` |  | `ECCurve curve = new FpCurve(p, a, b, n, h);`
| 1 | `89` |  | `X9ECPoint G = new X9ECPoint(curve, Hex.Decode("04"`
| 1 | `90` |  | `+ "00C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA`
| 1 | `91` |  | `+ "011839296A789A3BC0045C8A5FB42C7D1BD998F54449579B446817AFBD17273E662C97EE72995EF42640C550B9013FAD0`
|  | `92` |  | ``
| 1 | `93` |  | `return new X9ECParameters(curve, G, n, h, S);`
| 1 | `94` |  | `}`
|  | `95` |  | `}`
|  | `96` |  | ``
|  | `97` |  | `public static X9ECParameters GetByName(`
|  | `98` |  | `string name)`
| 45 | `99` |  | `{`
| 45 | `100` |  | `switch(name)`
|  | `101` |  | `{`
|  | `102` |  | `case "P-256":`
|  | `103` |  | `case "secp256r1":`
| 15 | `104` |  | `return Secp256r1Holder.Instance.Parameters;`
|  | `105` |  | `case "P-384":`
|  | `106` |  | `case "secp384r1":`
| 15 | `107` |  | `return Secp384r1Holder.Instance.Parameters;`
|  | `108` |  | `case "P-521":`
|  | `109` |  | `case "secp521r1":`
| 15 | `110` |  | `return Secp521r1Holder.Instance.Parameters;`
|  | `111` |  | `}`
|  | `112` |  | ``
| 0 | `113` |  | `return null;`
| 45 | `114` |  | `}`
|  | `115` |  | ``
|  | `116` |  | `private static BigInteger FromHex(string hex)`
| 12 | `117` |  | `{`
| 12 | `118` |  | `return new BigInteger(1, Hex.Decode(hex));`
| 12 | `119` |  | `}`
|  | `120` |  | `}`
|  | `121` |  | `}`

# Methods/Properties

.ctor()
.cctor()
CreateParameters()
.ctor()
.cctor()
CreateParameters()
.ctor()
.cctor()
CreateParameters()
GetByName(System.String)
FromHex(System.String)