The problem is that the SHA-512 RSA certificate is not being sent in the TLS 1.2 exchange with mutual authentication, while other certificates that are SHA-256 work with no problem.
I have read other questions like this one and this one but in those examples the certificates where SHA-1 or MD5 and the answers didn't help me.
This is the server I am trying to connect with (I cannot change it).
Here is my code:
var handler = new HttpClientHandler();
handler.ClientCertificateOptions = ClientCertificateOption.Manual;
handler.ClientCertificates.Add(wch.Certificate);
var httpClient = new HttpClient(handler);
string soapUI = "<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:xsd=\"http://ekuatia.set.gov.py/sifen/xsd\">\r\n <soap:Header/>\r\n <soap:Body>\r\n <xsd:rEnviConsRUC>\r\n <xsd:dId>1584127</xsd:dId>\r\n <xsd:dRUCCons>80016799</xsd:dRUCCons>\r\n </xsd:rEnviConsRUC>\r\n </soap:Body>\r\n</soap:Envelope>";
var mediaType = "application/soap+xml";
var content = new StringContent(soapUI, Encoding.UTF8, mediaType);
var response = httpClient.PostAsync("https://sifen-test.set.gov.py/de/ws/consultas/consulta-ruc.wsdl", content).Result;
And this is what I see in Wireshark when I check the exchange:
SHA-256 RSA Certificate, works okay.
SHA-512 RSA Certificate, doesn't work.
Any help is highly appreciated.
An update, changing protocol to TLS 1.1 also works with SHA-512, but we need to use TLS 1.2.