C#x509Store访问网络托管
我在证书存储的网络托管文件夹中存储了一个SSL证书。我似乎无法从C#访问此商店。有人知道该怎么做吗?
X509Store store = new X509Store("Web Hosting");
store.Open(OpenFlags.ReadOnly);
var t = store.Certificates.GetEnumerator();
while (t.MoveNext())
{
//this is always empty
}
其他细节 我需要此证书来用于我正在写的GRPC服务。 GRPC需要SSL连接的证书。同时,我正在使用我们使用的加密来生成证书。当证书生成时,证书被放入证书商店的网络托管文件夹中。
I have an SSL cert stored in the Web Hosting Folder of the Certificate Store. I cannot seem to be able to access this store from C#. Does anyone know how to do this?
X509Store store = new X509Store("Web Hosting");
store.Open(OpenFlags.ReadOnly);
var t = store.Certificates.GetEnumerator();
while (t.MoveNext())
{
//this is always empty
}
Additional Detail
I need this cert for a gRPC service that I am writing. gRPC requires a certificate for the SSL connection. In the mean time aka development I am using Let's Encrypt to generate the certificate. When the cert was generated the cert was put into the Web Hosting folder of the cert store.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这有效:
This works:
事实证明,您可以将证书拖放到证书经理中的其他位置。我将证书搬到了个人文件夹中,并且能够通过:
It turns out you can drag and drop the certs to a different location in the cert manager. I relocated the cert to the Personal folder and I was able to access it by:
尝试删除空间;例如,尝试将名称作为
WebHosting
(无空间)在PowerShell中,以在此商店的位置显示证书:
Try removing the space; e.g., try the name as
webhosting
(no space)In PowerShell, to display certs in this store location: