Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TLS Example #40

Open
NVentimiglia opened this issue Oct 1, 2015 · 14 comments
Open

TLS Example #40

NVentimiglia opened this issue Oct 1, 2015 · 14 comments

Comments

@NVentimiglia
Copy link

I am trying to connect to a websocket server using TLS and I am receiving a exception "The authentication or decryption has failed."

The URI I am passing is :

"wss://ortc-developers2-uswest2-s0001.realtime.co:443/broadcast/926/WNWJYJUQ/websocket"

My constructor looks like

_websocket = new WebSocket(uri, SslProtocols.Tls12.ToString(), WebSocketVersion.Rfc6455);

(I am pretty sure this is wrong, but I do not see any docs)

@kerryjiang
Copy link
Owner

Just only keep the first parameter in the constructor. The other two are not necessary.
Make sure the certificate of your server side is setup correct.

@NVentimiglia
Copy link
Author

Using MonoDroid

There is no constructor with only a single parameter.

Internally are we using an Android Websocket implementation or are we using a Mono / .Net implementation. I ask because If we are using mono, It is a known issue that TLS is nonfunctional.

@kerryjiang
Copy link
Owner

The second parameter is not for transfer level security protocol like SSL/TLS. Instead, it's for application level sub protocol.

There is a constructor with only one required parameter, other parameters are optional:
https://github.com/kerryjiang/WebSocket4Net/blob/master/WebSocket4Net/WebSocket.Net.cs

Do you mean there is a know issue about MonoDroid TLS, so you want to use TLS12?

@NVentimiglia
Copy link
Author

badmethod

CS0121 The call is ambiguous between the following methods or properties: 'WebSocket.WebSocket(string, string, List<KeyValuePair<string, string>>, List<KeyValuePair<string, string>>, string, string, WebSocketVersion)' and 'WebSocket.WebSocket(string, string, List<KeyValuePair<string, string>>, List<KeyValuePair<string, string>>, string, string, WebSocketVersion, EndPoint)'

I am using the version on Nuget, should I be using another version ?

Known Issue

rdavisau/sockets-for-pcl#35

@DragonFly81
Copy link

@kerryjiang Hi. Any news on when Websocket4Net will be capable of accommodating TLS 1.1 and up? My client code connects to various 3rd party websocket servers and some of them no longer support TLS 1.0 due to POODLE vulnerability...

@kerryjiang
Copy link
Owner

@DragonFly81 Hello, there is already a constructor allowing the SslProtocols parameter in the latest WebSocket4Net.

@DragonFly81
Copy link

@kerryjiang Thanks for the reply. Please forgive me if I'm misunderstanding something, but I don't see a "SslProtocols"-parameter in any of the constructors. Are you referring to the "WebSocketVersion"-parameter? If so, I've tried all the options in the enumerator (including "Rfc6455") but its seems the highest TLS that gets used in the handshake is version 1.0, resulting in an "The client and server cannot communicate, because they do not possess a common algorithm"-error. Could you possibly give an example of the constructor using TLS 1.2 (RFC5246) or even TLS 1.1 (RFC4346) exclusively? Thanks for your time.

@vraikov
Copy link

vraikov commented May 19, 2016

The version on nuget 0.14.1.0 was published before the parameter was introduced.
There is such a constructor on github.

@jmortlock
Copy link

@kerryjiang Any ideas on when a new version will be published to NuGet? not having the TLS options in the 0.14.1 released version is causing us some grief when connecting to a crossbars.io server which enables TLS1.2 only. Current workaround is to build manually and use the resulting DLLs, but as we also use an upstream project WampSharp this also means a rebuild of that solution as well, obviously not ideal.

@kerryjiang
Copy link
Owner

@jmortlock Could you try the latest beta version?
https://www.nuget.org/packages/WebSocket4Net/0.15.0-beta2

You can setup SslProtocols through the new property "Securiity".

@darkl
Copy link
Contributor

darkl commented Aug 24, 2016

The Security property seems to be readonly.

Elad

@kerryjiang
Copy link
Owner

Yes, but the properties of Security are not.

@Raj123456788
Copy link

has anyone got this working?

@plinehan
Copy link

Yes, using https://www.nuget.org/packages/WebSocket4Net/0.15.0-beta6 I can specify the SSL protocols like this:

var socket = new WebSocket(url, sslProtocols: SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls);

@kerryjiang perhaps it is time to mark 0.15.0-beta6 as the stable version? It appears relatively popular based on downloads, and is nearly 6 months old now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants