是的,我知道 SO 和谷歌上有很多类似的问题。是的,我已经阅读了所有内容并尝试了那里所说的一切。是的,任何解决方案都没有帮助我。
我有在 ASP.NET 应用程序上下文中使用的类库。我的类库从第三方 HTTPS 网站下载数据。该网站需要客户证书。我添加了证书LOCAL_MACHINE\MY
并在winhttpcertcfg
.
我的LogIn
方法在商店中找到了该证书。正如我在调试输出中看到的 - 在这个阶段一切都很好。但后来,当我尝试加载页面时,我得到了The request was aborted: Could not create SSL/TLS secure channel.
异常。
我的代码:
client = new XHttpClient();
X509Store store;
X509CertificateCollection certificates;
store = new X509Store(StoreLocation.LocalMachine);
store.Open(OpenFlags.ReadOnly);
certificates = store.Certificates.Find(
X509FindType.FindByIssuerName,
"Xxxxxxxx Root CA", true);
// everything is fine here, certificates[0] is my certificate
client.ClientCertificates.AddRange(certificates);
store.Close();
有任何想法吗?