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

Allow settings TLS protocols in WebSocket options #374

Open
0xAliHn opened this issue Mar 20, 2018 · 2 comments
Open

Allow settings TLS protocols in WebSocket options #374

0xAliHn opened this issue Mar 20, 2018 · 2 comments

Comments

@0xAliHn
Copy link

0xAliHn commented Mar 20, 2018

I am using android API 19 for my project. But as mentioned in the android developer https://developer.android.com/reference/javax/net/ssl/SSLSocket.html documentation TLSv1.2 protocols is not enabled by default in android API <20.

As I am using API 19 and we must need to enable TLSv1.2 for successful handshaking.
Currently getting below error:
connection close, Notification: 5 reason: WebSockets internal error (javax.net.ssl.SSLException: Read error: ssl=0xb7747000: I/O error during system call, Software caused connection abort)

This can be handled using below implementation in CustomSocketFactory/SocketFactory:

private Socket enableTLSOnSocket(Socket socket) {
        if(socket != null && (socket instanceof SSLSocket)) {
            ((SSLSocket)socket).setEnabledProtocols(new String[] {"TLSv1.1", "TLSv1.2"});
        }
        return socket;
    }

Would you please help us to implement this in your autobahn java library or any API exposure will be appreciated.

@oberstet
Copy link
Contributor

I think best would be to expose knobs for a user to choose the TLS versions desired. Eg some users might opt for "1.2 only" ..

@oberstet
Copy link
Contributor

signatures of the new knobs on WebSocketOptions should mirror SSLSocket :

public void setTLSEnabledProtocols(String[] protocols);
public String[] getTLSEnabledProtocols();

@oberstet oberstet changed the title TLSv1.2 protocols is not enabled by default in android API <20. Need to enable manually. Allow settings TLS protocols in WebSocket options Mar 21, 2018
@oberstet oberstet added WebSocket Android Android specific issue and removed needs-discussion labels Mar 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants