From e1b23afb4e4eed33442875bf297dc7f28b5009c2 Mon Sep 17 00:00:00 2001 From: Karim H Date: Tue, 17 Aug 2021 20:48:18 +0100 Subject: [PATCH] Added Legacy SSL support --- .../jivesoftware/smack/ConnectionConfiguration.java | 7 ++++++- .../jivesoftware/smack/tcp/XMPPTCPConnection.java | 12 ++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java b/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java index 23e664e94d..dee69e5de8 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java @@ -518,7 +518,12 @@ public enum SecurityMode { * be used. If only TLS encryption is available from the server, the connection * will fail. */ - disabled + disabled, + + /** + * Legacy SSL encryption. + */ + legacy } /** diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java index c1dc8b7ee6..0864b3d789 100644 --- a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java +++ b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java @@ -628,6 +628,18 @@ private void connectUsingConfiguration() throws ConnectionException, IOException break innerloop; } } + + // Legacy SSL + if (ConnectionConfiguration.SecurityMode.legacy == config.getSecurityMode()) { + try { + proceedTLSReceived(); + } catch (Exception e) { + LOGGER.finer("Could not enable SSL encryption while connecting to " + inetSocketAddress); + RemoteConnectionException rce = new RemoteConnectionException<>( + endpoint, inetAddress, e); + connectionExceptions.add(rce); + } + } LOGGER.finer("Established TCP connection to " + inetSocketAddress); // We found a host to connect to, return here this.host = host;