aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/utils/TLSSocketFactory.java
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/main/java/de/pixart/messenger/utils/TLSSocketFactory.java20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/main/java/de/pixart/messenger/utils/TLSSocketFactory.java b/src/main/java/de/pixart/messenger/utils/TLSSocketFactory.java
index cfefbd93d..84b361dea 100644
--- a/src/main/java/de/pixart/messenger/utils/TLSSocketFactory.java
+++ b/src/main/java/de/pixart/messenger/utils/TLSSocketFactory.java
@@ -17,11 +17,18 @@ public class TLSSocketFactory extends SSLSocketFactory {
private final SSLSocketFactory internalSSLSocketFactory;
public TLSSocketFactory(X509TrustManager[] trustManager, SecureRandom random) throws KeyManagementException, NoSuchAlgorithmException {
- SSLContext context = SSLContext.getInstance("TLS");
+ SSLContext context = SSLSocketHelper.getSSLContext();
context.init(null, trustManager, random);
this.internalSSLSocketFactory = context.getSocketFactory();
}
+ private static Socket enableTLSOnSocket(Socket socket) {
+ if (socket != null && (socket instanceof SSLSocket)) {
+ SSLSocketHelper.setSecurity((SSLSocket) socket);
+ }
+ return socket;
+ }
+
@Override
public String[] getDefaultCipherSuites() {
return CryptoHelper.getOrderedCipherSuites(internalSSLSocketFactory.getDefaultCipherSuites());
@@ -56,15 +63,4 @@ public class TLSSocketFactory extends SSLSocketFactory {
public Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort) throws IOException {
return enableTLSOnSocket(internalSSLSocketFactory.createSocket(address, port, localAddress, localPort));
}
-
- private static Socket enableTLSOnSocket(Socket socket) {
- if(socket != null && (socket instanceof SSLSocket)) {
- try {
- SSLSocketHelper.setSecurity((SSLSocket) socket);
- } catch (NoSuchAlgorithmException e) {
- //ignoring
- }
- }
- return socket;
- }
} \ No newline at end of file