0
I need to use TLS 1.2 in an HTTP request with Restsharp.
Every time I make a POST, it reports the error "The underlying connection was closed: Could not establish trust for secure SSL/TLS channel.".
private void CriarServicoWebEEnviar(string url, byte[] sig)
{
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
var client = new RestClient(url);
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/pkcs7-signature");
request.AddParameter("application/pkcs7-signature", sig, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
}
I’m using Visual Studio 2010 with . NET Framework 4.0
are you sure you are using TLS 1.2? in your code does not show this, which version of the Framework is using?
– Ricardo Pontual
Ricardo, I’m using framework 4.0. I updated the question with more information.
– Ricardo Carvalho
just to confirm... is with https and knocking with the indicated port?
– Leandro Angelo