From f162458323365bdd2a8aa0a1a97e5a79753ccf0d Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Tue, 2 Oct 2018 21:55:18 +0200 Subject: use sni and alpn for start tls as well. apperently google requires it --- src/main/java/de/pixart/messenger/utils/TLSSocketFactory.java | 2 +- src/main/java/de/pixart/messenger/xmpp/XmppConnection.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/de/pixart/messenger/utils/TLSSocketFactory.java b/src/main/java/de/pixart/messenger/utils/TLSSocketFactory.java index 84b361dea..6daa9ac9b 100644 --- a/src/main/java/de/pixart/messenger/utils/TLSSocketFactory.java +++ b/src/main/java/de/pixart/messenger/utils/TLSSocketFactory.java @@ -23,7 +23,7 @@ public class TLSSocketFactory extends SSLSocketFactory { } private static Socket enableTLSOnSocket(Socket socket) { - if (socket != null && (socket instanceof SSLSocket)) { + if (socket instanceof SSLSocket) { SSLSocketHelper.setSecurity((SSLSocket) socket); } return socket; diff --git a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java index bb4edda5c..cd2a13bd4 100644 --- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java +++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java @@ -875,6 +875,8 @@ public class XmppConnection implements Runnable { } SSLSocketHelper.setSecurity(sslSocket); + SSLSocketHelper.setHostname(sslSocket, account.getServer()); + SSLSocketHelper.setApplicationProtocol(sslSocket, "xmpp-client"); if (!tlsFactoryVerifier.verifier.verify(account.getServer(), this.verifiedHostname, sslSocket.getSession())) { Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": TLS certificate verification failed"); -- cgit v1.2.3