SSL上的请求失败

时间:2015-08-06 08:24:49

标签: c# ssl certificate smartcard restsharp

我正在创建需要的C#/ .NET应用程序 验证智能卡上的证书。

基本上在Chrome / Firefox中,用户将卡存储到智能卡插槽/设备,然后将认证存储到计算机,然后在浏览器中显示输入图钉的窗口(特定网址)。

我正在创建基于此使用登录的应用程序。在登录时,我应该在正确输入引脚后从该特定URL获得GET 200响应(该引脚的窗口不是来自我的应用程序,并且在调用client.Execute来自restsharp时打开)。

我的代码看起来像这样

        // We need to allow other security protocol types
        ServicePointManager.SecurityProtocol =  SecurityProtocolType.Tls11 | SecurityProtocolType.Ssl3 |
                                               SecurityProtocolType.Tls12 | SecurityProtocolType.Tls;

        // WSE 3.0 methods
        X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
        store.Open(OpenFlags.ReadOnly);
        string findValue = "MyCompany";
        X509Certificate2Collection certsCollection = store.Certificates.Find(X509FindType.FindByIssuerName, findValue, false);

        var client = new RestClient("https://blablabla.test.com");
        client.ClientCertificates = certsCollection;
        var request = new RestRequest("ssltest3/", Method.GET);

        var response = client.Execute(request);

        return true

正如您所看到的,我正在使用RestSharp for GET请求。当我第一次正确输入引脚时,一切顺利。但是当我输入第一个坏针并且在此之后,我得到了响应“请求被中止:无法创建SSL / TLS安全通道。”

我们检查apache,当输入pin时,后台有一些空的GET请求。

我还尝试将ServicePointManager.ServerCertificateValidationCallback设置为true,但这不起作用。

mycrosoft cryptoapi很奇怪,但我不想使用pkc11。

任何想法都没有“不能......”? 我花了很多时间在这.......

0 个答案:

没有答案
相关问题