I am connecting with a https protected by an extra certificate check (via a smart card).
My problem is that when I call the endpoint from .NET/C# it throws "The request was aborted: Could not create SSL/TLS secure channel.", calling it from Chrome works fine. I managed to trace the problem with Wireshark and the culprit is when the client exchanges the algorithm for Certificate Verify.
Broken:
Working:
My code:
public string GetToken()
{
var req = HttpWebRequest.CreateHttp(this.AuthenticationUrl);
req.Method = "GET";
req.ClientCertificates.Add(this.Certificate);
var resp = req.GetResponse() as HttpWebResponse;
using (var respStream = resp.GetResponseStream())
using (var respReader = new StreamReader(respStream))
{
string xml = respReader.ReadToEnd();
var doc = XDocument.Parse(xml);
var message = doc.FirstNode as XElement;
var content = message.Descendants().FirstOrDefault(p => p.Name.LocalName == "contents");
this.Token = content.Descendants().FirstOrDefault(p => p.Name.LocalName == "accessToken").Attribute("value").Value;
string expires = content.Descendants().FirstOrDefault(p => p.Name.LocalName == "expiresOn").Attribute("value").Value;
this.TokenExpiresOn = DateTime.Parse(expires);
return this.Token;
}
}
this.Certificate is a valid X509Certificate2 from a smart card.
It seems that .NET somehow sets rsa_pss_rsae_sha256 and the server can't handle it?
How can I force .NET/C# to use rsa_pkcs1_sha256?

