我有一堆字符串和pfx证书,我想存储在Azure Key保险库中,只允许用户/应用程序获取它们.将字符串存储为Secret并不难,但是如何以可以检索它的方式序列化证书并在C#中反序列化为X509Certificate2对象?
我试着将它存储为密钥.这是Azure powershell代码
$securepfxpwd = ConvertTo-SecureString -String 'superSecurePassword' -AsPlainText -Force
$key = Add-AzureKeyVaultKey -VaultName 'UltraVault' -Name 'MyCertificate' -KeyFilePath 'D:\Certificates\BlaBla.pfx' -KeyFilePassword $securepfxpwd
Run Code Online (Sandbox Code Playgroud)
但是当我试图用GetKeyAsync方法获取它时,我无法使用它.