无法从X509Store读取CurrentUser证书 [英] Can't read CurrentUser certificates from X509Store
问题描述
我正在开发ASP.NET 4.0 Web应用程序,并且我想从X509Store中读取当前的用户证书.读取LocalMachine证书可以很好地工作,但是如果我将StoreLocation设置为CurrentUser,它会给我一个空的集合.
I'm developing ASP.NET 4.0 web application, and I want to read the current user certificates from X509Store. Reading the LocalMachine certificates works fine, but if I set the StoreLocation to CurrentUser, it gives me an empty collection.
以下代码可以正常工作:
The following code works fine :
X509Store store = new X509Store(StoreName.My, StoreLocation.LocalMachine); // StoreLocation.CurrentUser
store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
我已经通过certmgr.mmc检查了我的个人商店,并且我确定我有证书.
I've checked my personal store (via certmgr.mmc) and I'm sure that I have the certificates.
我想念什么?(store.Certificates为空)
What am I missing ? ( store.Certificates is empty )
推荐答案
看来,无论您使用什么应用程序池标识,都无法通过Web应用程序访问个人证书存储.
It appears that you can not access the Personal Certificate Store via web application, no matter what application pool identity you're using.
这很有意义,Web应用程序无法访问该位置.:)
It makes sense, a web application has no access to that location. :)
我的解决方案:
我已经开发了ActiveX控件,我认为它是访问商店的唯一方法.(此外,Java Applet提供相同的功能).我通过JavaScript使用ActiveX控件来访问商店,并将该信息发送到服务器.
I've developed an ActiveX control which I think its the only way to access the Store. (Also, a Java Applet offers the same functionality). I use the ActiveX control via JavaScript to access the Store, and send that information to the server.
这篇关于无法从X509Store读取CurrentUser证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!