< Summary

Class:Azure.Security.KeyVault.Certificates.CertificateKeyCurveName
Assembly:Azure.Security.KeyVault.Certificates
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Certificates\src\CertificateKeyCurveName.cs
Covered lines:4
Uncovered lines:9
Coverable lines:13
Total lines:85
Line coverage:30.7% (4 of 13)
Covered branches:1
Total branches:6
Branch coverage:16.6% (1 of 6)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%50%
get_P256()-100%100%
get_P384()-0%100%
get_P521()-0%100%
get_P256K()-0%100%
op_Equality(...)-0%100%
op_Inequality(...)-0%100%
op_Implicit(...)-0%100%
Equals(...)-0%0%
Equals(...)-0%100%
GetHashCode()-0%0%
ToString()-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Certificates\src\CertificateKeyCurveName.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.ComponentModel;
 6
 7namespace Azure.Security.KeyVault.Certificates
 8{
 9    /// <summary>
 10    /// Elliptic Curve Cryptography (ECC) curve names.
 11    /// </summary>
 12    public readonly struct CertificateKeyCurveName : IEquatable<CertificateKeyCurveName>
 13    {
 14        private readonly string _value;
 15
 16        /// <summary>
 17        /// Initializes a new instance of the <see cref="CertificateKeyCurveName"/> structure.
 18        /// </summary>
 19        /// <param name="value">The string value of the instance.</param>
 20        public CertificateKeyCurveName(string value)
 21        {
 822            _value = value ?? throw new ArgumentNullException(nameof(value));
 823        }
 24
 25        /// <summary>
 26        /// Gets the NIST P-256 elliptic curve, AKA SECG curve SECP256R1
 27        /// For more information, see <see href="https://docs.microsoft.com/azure/key-vault/keys/about-keys#curve-types"
 28        /// </summary>
 429        public static CertificateKeyCurveName P256 { get; } = new CertificateKeyCurveName("P-256");
 30
 31        /// <summary>
 32        /// Gets the NIST P-384 elliptic curve, AKA SECG curve SECP384R1.
 33        /// For more information, see <see href="https://docs.microsoft.com/azure/key-vault/keys/about-keys#curve-types"
 34        /// </summary>
 035        public static CertificateKeyCurveName P384 { get; } = new CertificateKeyCurveName("P-384");
 36
 37        /// <summary>
 38        /// Gets the NIST P-521 elliptic curve, AKA SECG curve SECP521R1.
 39        /// For more information, see <see href="https://docs.microsoft.com/azure/key-vault/keys/about-keys#curve-types"
 40        /// </summary>
 041        public static CertificateKeyCurveName P521 { get; } = new CertificateKeyCurveName("P-521");
 42
 43        /// <summary>
 44        /// Gets the SECG SECP256K1 elliptic curve.
 45        /// For more information, see <see href="https://docs.microsoft.com/azure/key-vault/keys/about-keys#curve-types"
 46        /// </summary>
 047        public static CertificateKeyCurveName P256K { get; } = new CertificateKeyCurveName("P-256K");
 48
 49        /// <summary>
 50        /// Determines if two <see cref="CertificateKeyCurveName"/> values are the same.
 51        /// </summary>
 52        /// <param name="left">The first <see cref="CertificateKeyCurveName"/> to compare.</param>
 53        /// <param name="right">The second <see cref="CertificateKeyCurveName"/> to compare.</param>
 54        /// <returns>True if <paramref name="left"/> and <paramref name="right"/> are the same; otherwise, false.</retur
 055        public static bool operator ==(CertificateKeyCurveName left, CertificateKeyCurveName right) => left.Equals(right
 56
 57        /// <summary>
 58        /// Determines if two <see cref="CertificateKeyCurveName"/> values are different.
 59        /// </summary>
 60        /// <param name="left">The first <see cref="CertificateKeyCurveName"/> to compare.</param>
 61        /// <param name="right">The second <see cref="CertificateKeyCurveName"/> to compare.</param>
 62        /// <returns>True if <paramref name="left"/> and <paramref name="right"/> are different; otherwise, false.</retu
 063        public static bool operator !=(CertificateKeyCurveName left, CertificateKeyCurveName right) => !left.Equals(righ
 64
 65        /// <summary>
 66        /// Converts a string to a <see cref="CertificateKeyCurveName"/>.
 67        /// </summary>
 68        /// <param name="value">The string value to convert.</param>
 069        public static implicit operator CertificateKeyCurveName(string value) => new CertificateKeyCurveName(value);
 70
 71        /// <inheritdoc/>
 72        [EditorBrowsable(EditorBrowsableState.Never)]
 073        public override bool Equals(object obj) => obj is CertificateKeyCurveName other && Equals(other);
 74
 75        /// <inheritdoc/>
 076        public bool Equals(CertificateKeyCurveName other) => string.Equals(_value, other._value, StringComparison.Ordina
 77
 78        /// <inheritdoc/>
 79        [EditorBrowsable(EditorBrowsableState.Never)]
 080        public override int GetHashCode() => _value?.GetHashCode() ?? 0;
 81
 82        /// <inheritdoc/>
 283        public override string ToString() => _value;
 84    }
 85}