Skip to main content
 首页 » 编程设计

c#之Azure Key Vault API 的有效 WebKeyTypes 列表是什么

2024年04月18日42小虾米

我正在尝试在 Azure Key Vault 中创建一个新 key 通过 API KeyVaultClient.CreateKeyAsync :

public Task<KeyBundle> CreateKeyAsync ( 
    string vaultAddress, 
    string keyType, 
    KeyAttributes keyAttributes) 

keyType 的文档是:

The type of key to create (one of the valid WebKeyTypes)

什么是有效的 WebKeyType??


我搜索了 MSDN 文档,但没有找到任何内容。 Powershell call好像不需要这个参数??:

Parameter Set: Create 
Add-AzureKeyVaultKey  
          [-VaultName] <String>  
          [-Name] <String>  
          -Destination <String> {HSM | Software}  
          [-Disable]  
          [-Expires <DateTime]> ]  
          [-KeyOps <String[]> ]  
          [-NotBefore <DateTime]> ]  
          [-Tags <System.Collections.Hashtable> ]  
          [ <CommonParameters>] 

请您参考如下方法:

查看 Azure KeyVault SDK on Github 的源代码,我唯一能找到的是 JsonWebKeyTypes .根据源代码,以下是可能的值:

public const string EllipticCurve = "EC"; 
public const string Rsa           = "RSA"; 
public const string RsaHsm        = "RSA-HSM"; 
public const string Octet         = "oct"; 

然而看着 REST API documentation ,我相信目前仅支持 RSA 和 RSA-HSM。