简体   繁体   English

如何在C#请求中包括两个SSL证书

[英]How to include two SSL certificates in C# request

I'm trying to connect to Java web service with C# client. 我正在尝试使用C#客户端连接到Java Web服务。 I don't have physical access to that service, but I was told by it's developers that I need to provide client certificate AND intermediate CA in my requests. 我没有对该服务的物理访问权,但是它的开发人员告诉我,我需要在请求中提供客户端证书和中间CA。

I tried using Service Reference and WebClient but I only managed to send just client certificate. 我尝试使用Service Reference和WebClient,但仅设法仅发送客户端证书。

protected override WebRequest GetWebRequest(Uri address)
    {
        HttpWebRequest request = (HttpWebRequest)base.GetWebRequest(address);

        request.ClientCertificates.Add(m_TransportCertificate); 
        //m_TransportCertificate holds client certificate with key and rest of the cert chain (intermediate and root)

        return request;
    }

How to send two client certificates in C#? 如何在C#中发送两个客户端证书? As far as i know it isn't normal behaviour - client should only send one certificate. 据我所知,这是不正常的行为-客户只能发送一份证书。

I can't make my app to do it - it always sends one certificate. 我无法让我的应用执行此操作-它总是发送一个证书。 Wireshark screenshot Wireshark屏幕截图

However it works in SoapUI (the second one is intermediate CA) Wireshark screenshot 但是它可以在SoapUI中工作(第二个是中间CA) Wireshark屏幕截图

I found a solution. 我找到了解决方案。 Intermediate CA was automatically installed in Intermediate Certification Authorities but it needs to be in Trusted Root Certification Authorities . 中级CA自动安装在中级证书颁发机构中,但它必须位于受信任的根证书颁发机构中

Just moved it there and it worked. 只是将其移到那里就可以了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 RestSharp c# 验证 SSL 证书 - How to authenticate SSL certificates using RestSharp c# 如何在C#中将SSL证书与HttpWebRequest一起使用? - How do I use SSL certificates with HttpWebRequest in C#? C#Metro应用程序中的Windows SSL证书 - Windows SSL Certificates in C# Metro Application SSL证书可以在Java中工作,但不能在C#中工作 - SSL with certificates working in Java but not in C# 如何使用IP地址而不是DNS(.net C#)获得SSL证书 - How to get ssl certificates using IP address instead of DNS (.net C#) 如何使用 C#、WMI 和/或 System.Management 从 IIS 6.0 获取站点列表和 SSL 证书? - How to get a list of sites and SSL certificates from IIS 6.0 using C#, WMI, and/or System.Management? 是否可以从C#中的根CA即时生成SSL证书? - Is it possible to generate on the fly SSL certificates from a root CA in C#? 信任存储在c#中“受信任的根证书颁发机构”中的SSL证书 - Trusting SSL certificates stored in “Trusted Root Certification Authorities” in c# Firefox中使用WebDriver和C#的不受信任的SSL证书 - Untrusted SSL Certificates in Firefox Using WebDriver and C# 列出 c# 中的 SSL 证书(重新创建 IIS 绑定对话框) - List SSL certificates in c# (recreate IIS bindings dialog)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM