forked from Azure/azure-sdk-for-net
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves Azure#16853
- Loading branch information
Showing
11 changed files
with
709 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
sdk/keyvault/Azure.Security.KeyVault.Keys/src/CreateOctKeyOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using Azure.Core; | ||
|
||
namespace Azure.Security.KeyVault.Keys | ||
{ | ||
/// <summary> | ||
/// The properties needed to create an AES key using the <see cref="KeyClient"/>. | ||
/// </summary> | ||
public class CreateOctKeyOptions : CreateKeyOptions | ||
{ | ||
/// <summary> | ||
/// Gets the name of the key to create. | ||
/// </summary> | ||
public string Name { get; } | ||
|
||
/// <summary> | ||
/// Gets the key type of the <see cref="JsonWebKey"/> to create, including <see cref="KeyType.Oct"/> and <see cref="KeyType.OctHsm"/>. | ||
/// </summary> | ||
public KeyType KeyType { get; } | ||
|
||
/// <summary> | ||
/// Gets or sets the key size in bits, such as 128, 192, or 256. If null, the service default is used. | ||
/// </summary> | ||
public int? KeySize { get; set; } | ||
|
||
/// <summary> | ||
/// Gets a value indicating whether to create a hardware-protected key in a hardware security module (HSM). | ||
/// </summary> | ||
/// <value><c>true</c> to create a hardware-protected key; otherwise, <c>false</c> to create a software key.</value> | ||
public bool HardwareProtected { get; } | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="CreateOctKeyOptions"/> class. | ||
/// </summary> | ||
/// <param name="name">The name of the key to create.</param> | ||
/// <param name="hardwareProtected">True to create a hardware-protected key in a hardware security module (HSM). The default is false to create a software key.</param> | ||
/// <exception cref="ArgumentException"><paramref name="name"/> is empty.</exception> | ||
/// <exception cref="ArgumentNullException"><paramref name="name"/> is null.</exception> | ||
public CreateOctKeyOptions(string name, bool hardwareProtected = false) | ||
{ | ||
Argument.AssertNotNullOrEmpty(name, nameof(name)); | ||
|
||
Name = name; | ||
HardwareProtected = hardwareProtected; | ||
if (hardwareProtected) | ||
{ | ||
KeyType = KeyType.OctHsm; | ||
} | ||
else | ||
{ | ||
KeyType = KeyType.Oct; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
135 changes: 135 additions & 0 deletions
135
...zure.Security.KeyVault.Keys/tests/SessionRecords/ManagedHsmLiveTests/CreateOctHsmKey.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.