-
Notifications
You must be signed in to change notification settings - Fork 5k
Description
Library name and version
Azure.Security.KeyVault.Keys 4.7.0
Describe the bug
public virtual async Task<Response> CreateKeyAsync(string name, KeyType keyType, CreateKeyOptions keyOptions = default, CancellationToken cancellationToken = default)
This function says that it "Creates and stores a new key in Key Vault. The create key operation can be used to create any key type in Azure Key Vault." However, the KeyOptions are not parsed correctly, causing RSA/Oct keys to always have default size and ECC keys to always have the default Curve, regardless if it is set in the options.
the call to var parameters = new KeyRequestParameters(keyType, keyOptions); navigates here
In this code, the is no parsing of the keytype to determine whether key size or curve needs to be set. This results in all keys created with the function to return keys with a default size/curve
Expected behavior
If you put in a key type and define the key options, a key is created of the input type with the size/curve defined in the key options input
Actual behavior
Key of proper type is created, but KeySize/Curve input in the options is dropped if it is included and default value is used
Reproduction Steps
Call this function with any key options and observe that the size/curve will not change in the returned key
public virtual async Task<Response> CreateKeyAsync(string name, KeyType keyType, CreateKeyOptions keyOptions = default, CancellationToken cancellationToken = default)
Environment
NET 4.7.2 and NET8
Metadata
Metadata
Assignees
Labels
Type
Projects
Status