< Summary

Class:Azure.Security.KeyVault.Keys.CreateRsaKeyOptions
Assembly:Azure.Security.KeyVault.Keys
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Keys\src\CreateRsaKeyOptions.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_KeySize()-100%100%
get_HardwareProtected()-0%100%
.ctor(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Keys\src\CreateRsaKeyOptions.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 CreateRsaKeyOptions : CreateKeyOptions
 13    {
 14        /// <summary>
 15        /// Gets the name of the key to create.
 16        /// </summary>
 13617        public string Name { get; }
 18
 19        /// <summary>
 20        /// Gets the key type of the <see cref="JsonWebKey"/> to create, including <see cref="KeyType.Rsa"/> and <see cr
 21        /// </summary>
 4422        public KeyType KeyType { get; }
 23
 24        /// <summary>
 25        /// Gets or sets the key size in bits, such as 2048, 3072, or 4096. If null, the service default is used.
 26        /// </summary>
 5227        public int? KeySize { 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="CreateRsaKeyOptions"/> 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>
 4442        public CreateRsaKeyOptions(string name, bool hardwareProtected = false)
 43        {
 4444            Argument.AssertNotNullOrEmpty(name, nameof(name));
 45
 4446            Name = name;
 4447            HardwareProtected = hardwareProtected;
 4448            if (hardwareProtected)
 49            {
 3650                KeyType = KeyType.RsaHsm;
 51            }
 52            else
 53            {
 854                KeyType = KeyType.Rsa;
 55            }
 856        }
 57    }
 58}