< Summary

Class:Microsoft.Azure.KeyVault.WebKey.JsonWebKeyCurveName
Assembly:Microsoft.Azure.KeyVault.WebKey
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Microsoft.Azure.KeyVault.WebKey\src\JsonWebKeyCurveName.cs
Covered lines:3
Uncovered lines:3
Coverable lines:6
Total lines:48
Line coverage:50% (3 of 6)
Covered branches:7
Total branches:8
Branch coverage:87.5% (7 of 8)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.cctor()-0%100%
get_AllCurves()-0%100%
GetKeyParameterSize(...)-75%87.5%

File(s)

C:\Git\azure-sdk-for-net\sdk\keyvault\Microsoft.Azure.KeyVault.WebKey\src\JsonWebKeyCurveName.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License. See License.txt in the project root for
 3// license information.
 4
 5namespace Microsoft.Azure.KeyVault.WebKey
 6{
 7    /// <summary>
 8    /// Elliptic Curve Cryptography (ECC) curve names.
 9    /// </summary>
 10    public static class JsonWebKeyCurveName
 11    {
 12        public const string P256 = "P-256";
 13        public const string P384 = "P-384";
 14        public const string P521 = "P-521";
 15        public const string P256K = "P-256K";
 16
 017        private static readonly string[] _allCurves = {P256, P384, P521, P256K};
 18
 19        /// <summary>
 20        /// All curves for EC. Use clone to avoid FxCop violation
 21        /// </summary>
 022        public static string[] AllCurves => (string[]) _allCurves.Clone();
 23
 24        /// <summary>
 25        /// Returns the required size, in bytes, of each key parameters (X, Y and D), or -1 if the curve is unsupported.
 26        /// </summary>
 27        /// <param name="curve">The curve for which key parameter size is required.</param>
 28        /// <returns></returns>
 29        public static int GetKeyParameterSize( string curve )
 30        {
 31            switch ( curve )
 32            {
 33                case P256:
 34                case P256K:
 7235                    return 32;
 36
 37                case P384:
 2238                    return 48;
 39
 40                case P521:
 2241                    return 66;
 42
 43                default:
 044                    return -1;
 45            }
 46        }
 47    }
 48}