简体   繁体   中英

How to include two SSL certificates in C# request

I'm trying to connect to Java web service with C# client. 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.

I tried using Service Reference and WebClient but I only managed to send just client certificate.

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#? 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

However it works in SoapUI (the second one is intermediate CA) Wireshark screenshot

I found a solution. Intermediate CA was automatically installed in Intermediate Certification Authorities but it needs to be in Trusted Root Certification Authorities .

Just moved it there and it worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM