We are using ASP.net core 1.1.2 and we are calling a HTTPS service which is TLS1.2 enabled. When we call from Httpclient we get the following security error.
System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.Http.WinHttpException: A security error occurred
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Net.Http.WinHttpHandler.<StartRequest>d__105.MoveNext()
Is there any way to enable TLS1.2 using httpclient using ASP core 1.x
The same https call works fine from postman
Note: We tried many possibilities like below,but none of them worked.
handler.ClientCertificateOptions = ClientCertificateOption.Automatic; handler.SslProtocols = SslProtocols.Tls11 | SslProtocols.Tls12 | SslProtocols.Tls; handler.PreAuthenticate = true; handler.ServerCertificateCustomValidationCallback += (message, cert, chain, errors) => { return true; };We tried adding options to registry key, this also failed
The new server has new ciphers added and The client must support one of the following TLS 1.2 cipher suites:
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384