< Summary

Class:Azure.Security.KeyVault.Keys.CreateEcKeyOptions
Assembly:Azure.Security.KeyVault.Keys
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Keys\src\CreateEcKeyOptions.cs
Covered lines:11
Uncovered lines:1
Coverable lines:12
Total lines:58
Line coverage:91.6% (11 of 12)
Covered branches:2
Total branches:2
Branch coverage:100% (2 of 2)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_Name()-100%100%
get_KeyType()-100%100%
get_CurveName()-100%100%
get_HardwareProtected()-0%100%
.ctor(...)-100%100%

File(s)

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

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using Azure.Core;
 6
 7namespace Azure.Security.KeyVault.Keys
 8{
 9    /// <summary>
 10    /// The properties needed to create an Elliptic Curve key using the <see cref="KeyClient"/>.
 11    /// </summary>
 12    public class CreateEcKeyOptions : CreateKeyOptions
 13    {
 14        /// <summary>
 15        /// Gets the name of the key to create.
 16        /// </summary>
 34017        public string Name { get; }
 18
 19        /// <summary>
 20        /// Gets the key type of the <see cref="JsonWebKey"/> to create, including <see cref="KeyType.Ec"/> and <see cre
 21        /// </summary>
 10822        public KeyType KeyType { get; }
 23
 24        /// <summary>
 25        /// Gets or sets the elliptic curve name. See <see cref="KeyCurveName"/> for possible values. If null, the servi
 26        /// </summary>
 22827        public KeyCurveName? CurveName { get; set; }
 28
 29        /// <summary>
 30        /// Gets a value indicating whether to create a hardware-protected key in a hardware security module (HSM).
 31        /// </summary>
 32        /// <value><c>true</c> to create a hardware-protected key; otherwise, <c>false</c> to create a software key.</va
 033        public bool HardwareProtected { get; }
 34
 35        /// <summary>
 36        /// Initializes a new instance of the <see cref="CreateEcKeyOptions"/> class.
 37        /// </summary>
 38        /// <param name="name">The name of the key to create.</param>
 39        /// <param name="hardwareProtected">True to create a hardware-protected key in a hardware security module (HSM).
 40        /// <exception cref="ArgumentException"><paramref name="name"/> is empty.</exception>
 41        /// <exception cref="ArgumentNullException"><paramref name="name"/> is null.</exception>
 10842        public CreateEcKeyOptions(string name, bool hardwareProtected = false)
 43        {
 10844            Argument.AssertNotNullOrEmpty(name, nameof(name));
 45
 10846            Name = name;
 10847            HardwareProtected = hardwareProtected;
 10848            if (hardwareProtected)
 49            {
 3650                KeyType = KeyType.EcHsm;
 51            }
 52            else
 53            {
 7254                KeyType = KeyType.Ec;
 55            }
 7256        }
 57    }
 58}