如何从Azure密钥保管库中的证书中获取私钥?

问题描述 投票:0回答:1

我在Azure密钥保管库中有一个证书,我想从中提取私钥。

根据Microsoft文档:When a Key Vault certificate is created, an addressable key and secret are also created with the same name. The Key Vault key allows key operations and the Key Vault secret allows retrieval of the certificate value as a secret.

但是,我一直没有从中提取私钥。这是我尝试过的一些python代码的示例:

pem_data  = get_secret('https://keyvault.azure.net/', 'x509-cert')
pem_data = '-----BEGIN CERTIFICATE----- ' + pem_data + ' -----END CERTIFICATE-----'
pem_data = pem_data.encode()
key = x509.load_pem_x509_certificate(pem_data,  backend=default_backend())
private_key = key.private_key()

但是,这将错误地指出它无法加载证书。

python azure x509certificate azure-keyvault key-pair
1个回答
0
投票

您可以检查KeyVault访问策略并查看检查的证书管理操作吗?

© www.soinside.com 2019 - 2024. All rights reserved.