2

I have successfully established a WebSocket connection between a Client and the Server using this libraries:

  • Client: github.com/TakahikoKawasaki/nv-websocket-client
  • Server: github.com/TooTallNate/Java-WebSocket

Now I'm going to encrypt this connection whit SSL, but I haven't understand how I have to do to do this. In particular I've seen this example (https://github.com/TooTallNate/Java-WebSocket/blob/master/src/main/example/SSLServerExample.java included in Java-WebSocket 1.3.0) where it require a KEYPASSWORD and a STOREPASSWORD, what are they? Instead in the other library (the client) it is not clear precisely how I should do... Thanks in advance!

1 Answer 1

2

In the case of nv-websocket-client:

Replace ws: with wss:. For example, if the endpoint of your server is ws://example.com/abc, change it to wss://example.com/abc. In most cases, all you have to do is it.

In some cases, special setup for SSL is required. In such a case, use either of the following methods.

  • WebSocketFactory.setSSLContext(SSLContext)
  • WebSocketFactory.setSSLSocketFactory(SocketFactory)

See "Create WebSocketFactory" in README.md of nv-websocket-client and the JavaDoc for details.

Sign up to request clarification or add additional context in comments.

1 Comment

But is the SSL certificate pinning possible with nv-websocket-client ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.