gpt4 book ai didi

azure - 如何检索生成的 Azure Key Vault 证书的 PFX 密码?

转载 作者:行者123 更新时间:2023-12-02 22:49:54 42 4
gpt4 key购买 nike

Azure Key Vault 允许您直接在 GUI 中生成证书。之后,您可以将这些证书下载为 pfx 文件。

这些 pfx 文件是否受密码保护?我正尝试在某处使用此证书,但如果没有密码,我将无法继续操作。

Azure Key Vault Create a certificate

最佳答案

使用以下适用于 AzureRM 的 PowerShell 脚本,我可以使用密码从 Key Vault 导出 pfx:

# Replace these variables with your own values
$vaultName = "<KEY_VAULT>"
$certificateName = "<CERTIFICATE_NAME>"
$pfxPath = [Environment]::GetFolderPath("Desktop") + "\$certificateName.pfx"
$password = "<PASSWORD>"

$pfxSecret = Get-AzureKeyVaultSecret -VaultName $vaultName -Name $certificateName
$pfxUnprotectedBytes = [Convert]::FromBase64String($pfxSecret.SecretValueText)
$pfx = New-Object Security.Cryptography.X509Certificates.X509Certificate2
$pfx.Import($pfxUnprotectedBytes, $null, [Security.Cryptography.X509Certificates.X509KeyStorageFlags]::Exportable)
$pfxProtectedBytes = $pfx.Export([Security.Cryptography.X509Certificates.X509ContentType]::Pkcs12, $password)
[IO.File]::WriteAllBytes($pfxPath, $pfxProtectedBytes)

归功于 Brendon Coombes his blog post .

关于azure - 如何检索生成的 Azure Key Vault 证书的 PFX 密码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66330093/

42 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com