【发布时间】:2020-11-24 14:09:00
【问题描述】:
我需要从需要客户端证书的 azure 函数应用调用 REST API。 我按照这个How to manage signed certificates with Azure Function V2 做了以下步骤:-
1)我已在私钥证书下的 TLS/SSL 设置中上传了我的私钥证书 (.PFX)。
2)在配置/应用程序设置下添加了一个键
WEBSITE_LOAD_CERTIFICATES:“我的证书指纹”
然后我尝试使用这个访问我的代码中的证书
使用系统; 使用 System.Security.Cryptography.X509Certificates;
...
X509Store certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);
certStore.Open(OpenFlags.ReadOnly);
X509Certificate2Collection certCollection = certStore.Certificates.Find(
X509FindType.FindByThumbprint,
// Replace below with your certificate's thumbprint
"000000000000000000000000000000000000000",
false);
// Get the first cert with the thumbprint
if (certCollection.Count > 0)
{
X509Certificate2 cert = certCollection[0];
// Use certificate
Console.WriteLine(cert.FriendlyName);
}
certStore.Close();
...
我没有取回任何证书。我究竟做错了什么? 如果我上传公共证书 (.cer),我可以访问该证书,但它没有私钥,因此我无法调用该服务。
【问题讨论】:
标签: azure azure-functions