我有一个证书需要用来访问Web服务。问题是,每当我尝试使用X509证书时,它都会要求输入密码(PIN)。有没有直接提供密码的方法,而且每次都没有弹出相同的窗口?使用X509Certificate而不需要密码
证书使用由欧贝特卡系统公司做了一个加密狗,如果它的任何帮助。下面是我用它来获得该证书的代码:
X509Store store = new X509Store("MY",StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
X509Certificate2Collection collection = (X509Certificate2Collection)store.Certificates;
if(collection.Count != 0)
userCert = collection[0]; // everything's ok up to here
这里的地方我使用的证书:
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(new Uri(url));
req.ClientCertificates.Add(userCert); // add the certificate I just got
// ...
WebResponse ret = req.GetResponse(); // here's where it asks me for my passphrase
+1谢谢你的信息。不幸的是,这不是我想听到的。这是由Oberthur完成还是这是所有令牌的标准功能(请求引脚)?我问这是因为我必须在一个应用程序中使用它,这个应用程序会被其他人从控制台调用。如果他们每次运行应用程序时都必须输入密码,这将非常糟糕。 – alex 2011-03-28 20:41:29
这是令牌的标准功能。通常情况下,您可以将令牌软件配置为仅提示第一次,然后在再次提示前允许x分钟访问证书。对不起,但我不知道Oberthur实施的细节。 – 2011-03-28 20:47:58