7

I'm trying to use RestSharp in Visual Studio 2012 Express on a fresh install of Windows 8.1. The API I'm trying to use supports only RC4-SHA for SSL. The certificate is valid.

var client = new RestClient(); client.BaseUrl = "https://teststore.mybigcommerce.com/api/v2/"; client.Authenticator = new HttpBasicAuthenticator("username", "key"); var request = new RestRequest(); request.Resource = "time.json"; IRestResponse response = client.Execute(bcrequest); 

I keep getting an error from the client: The request was aborted: Could not create SSL/TLS secure channel. I thought there were certificate problems, until I finally took a packet capture and discovered there were no cipher suites in common. RC4-SHA is not available on the client end. After installing Windows 7 and running the exact same code, the problem goes away.

Why is RC4-SHA unavailable in RestSharp on Windows 8.1?

2 Answers 2

12

I always add the following line of code before making the initial network connection to solve this issue.

System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12 | System.Net.SecurityProtocolType.Tls11 | System.Net.SecurityProtocolType.Tls11; 
Sign up to request clarification or add additional context in comments.

1 Comment

Setting the .Net SecurityProtocolType to the .Net TLS version 1.2 resolved it for me. Seems like Restsharp is selecting the incorrect one by default.
6
+50

I had an application the failed tls handshake after I insalled Win 8.1. My Wireshark captures on working and non working client logons showed missing cipher suites. Installing a real certificate on the server I was connecting to also solved the problem. The server had a self signed certificate.

I finally found this Microsoft article:

RC4 is no longer enabled by default for TLS. Applications (such as Internet Explorer) might fail to connect if they depend on RC4

You can enable RC4 support by configuring these registry keys with the following REG command:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\RC4 128/128]"Enabled"=dword:ffffffff

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\RC4 40/128]"Enabled"=dword:ffffffff

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\RC4 56/128]"Enabled"=dword:ffffffff

1 Comment

There is a solution for disable handshake programmatically (on dev version only, be careful !) on this site : robertgreiner.com/2013/03/… Just add line ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true; before any network call

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.