< Summary

Information
Class: Renci.SshNet.Security.Org.BouncyCastle.Crypto.Parameters.ECKeyParameters
Assembly: Renci.SshNet
File(s): \home\appveyor\projects\ssh-net\src\Renci.SshNet\Security\BouncyCastle\crypto\parameters\ECKeyParameters.cs
Line coverage
38%
Covered lines: 13
Uncovered lines: 21
Coverable lines: 34
Total lines: 79
Line coverage: 38.2%
Branch coverage
25%
Covered branches: 3
Total branches: 12
Branch coverage: 25%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
.cctor()100%1100%
.ctor(...)50%477.77%
get_AlgorithmName()100%10%
get_Parameters()100%1100%
Equals(...)0%40%
Equals(...)0%20%
GetHashCode()100%10%
CreateKeyGenerationParameters(...)100%10%
VerifyAlgorithmName(...)50%280%

File(s)

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

#LineLine coverage
 1using System;
 2
 3using Renci.SshNet.Security.Org.BouncyCastle.Security;
 4using Renci.SshNet.Security.Org.BouncyCastle.Utilities;
 5
 6namespace Renci.SshNet.Security.Org.BouncyCastle.Crypto.Parameters
 7{
 8    internal abstract class ECKeyParameters
 9        : AsymmetricKeyParameter
 10    {
 111        private static readonly string[] algorithms = { "EC", "ECDH" };
 12
 13        private readonly string algorithm;
 14        private readonly ECDomainParameters parameters;
 15
 16        protected ECKeyParameters(
 17            string        algorithm,
 18            bool        isPrivate,
 19            ECDomainParameters  parameters)
 2720            : base(isPrivate)
 2721        {
 2722            if (algorithm == null)
 023                throw new ArgumentNullException("algorithm");
 2724            if (parameters == null)
 025                throw new ArgumentNullException("parameters");
 26
 2727            this.algorithm = VerifyAlgorithmName(algorithm);
 2728            this.parameters = parameters;
 2729        }
 30
 31        public string AlgorithmName
 32        {
 033            get { return algorithm; }
 34        }
 35
 36        public ECDomainParameters Parameters
 37        {
 10838            get { return parameters; }
 39        }
 40
 41        public override bool Equals(
 42            object obj)
 043        {
 044            if (obj == this)
 045                return true;
 46
 047            ECDomainParameters other = obj as ECDomainParameters;
 48
 049            if (other == null)
 050                return false;
 51
 052            return Equals(other);
 053        }
 54
 55        protected bool Equals(
 56            ECKeyParameters other)
 057        {
 058            return parameters.Equals(other.parameters) && base.Equals(other);
 059        }
 60
 61        public override int GetHashCode()
 062        {
 063            return parameters.GetHashCode() ^ base.GetHashCode();
 064        }
 65
 66        internal ECKeyGenerationParameters CreateKeyGenerationParameters(
 67            SecureRandom random)
 068        {
 069            return new ECKeyGenerationParameters(parameters, random);
 070        }
 71
 72        internal static string VerifyAlgorithmName(string algorithm)
 3673        {
 3674            if (Array.IndexOf(algorithms, algorithm, 0, algorithms.Length) < 0)
 075                throw new ArgumentException("unrecognised algorithm: " + algorithm, "algorithm");
 3676            return algorithm.ToUpper();
 3677        }
 78    }
 79}