Hen*_*use 10 c# ssl azure azure-functions
我需要从Azure功能访问证书.
我按照Azure函数中的运行时错误加载证书中列出的步骤进行了操作,但它没有成功.
private static X509Certificate2 GetCertificate(string thumbprint, TraceWriter log)
{
X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
try
{
store.Open(OpenFlags.ReadOnly);
log.Info("Enumerating certificates");
foreach (var cert in store.Certificates) {
log.Info(cert.Subject);
}
var col = store.Certificates.Find(X509FindType.FindByThumbprint, thumbprint, false);
if (col == null || col.Count == 0)
{
return null;
}
return col[0];
}
finally
{
store.Close();
}
Run Code Online (Sandbox Code Playgroud)
}
上传到Azure功能的两个证书和设置WEBSITE_LOAD_CERTIFICATES也被添加,并设置为*或所需证书的thumpbrint,但无济于事.
GetCertificate方法应该打印商店中所有证书的列表,但商店是空的.
关于如何解决这个问题的任何线索?
| 归档时间: |
|
| 查看次数: |
4658 次 |
| 最近记录: |