I am building a connection to an external API. Basically I send them a request to an initial URL and they send me some JWK's wwhich have public, private keys that I then extract and construct a certificate from.
The second request I'm trying to send though doesn't even get to the point where I can send it out.
The certificate constructed looks like a valid certificate and the values send across look like the correct values since I copied them from an example application though something seems to be off.
I read some posts that c# will automatically refuse to send a request if the certificate is not bolted on properly but I've tried exporting it and using pfx format etc.
Does anyone have any idea?
' var testClient2 = new RestClient("someaddress");
ServicePointManager.Expect100Continue = true;
ServicePointManager.DefaultConnectionLimit = 9999;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3;
testClient2.Timeout = -1;
testClient2.ClientCertificates = new X509CertificateCollection() { certificat };
testClient2.Proxy = new WebProxy();
testClient2.PreAuthenticate = true;
var secondRequest = new RestRequest(Method.POST);
secondRequest.AddHeader("Accept", "application/json, application/javascript, text/javascript, text/json");
secondRequest.AddHeader("x-api-key", "somekey");
secondRequest.AddHeader("Content-Type", "application/jwt");
secondRequest.AddHeader("charset", "ISO-8859-1");
secondRequest.AddJsonBody(secondTokenString);
try
{
IRestResponse response2 = testClient2.Execute(secondRequest);
}
catch(Exception ex) {
}'
question from:
https://stackoverflow.com/questions/65920462/the-request-was-aborted-could-not-create-ssl-tls-secure-channel-using-restrequ 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…