aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/utils/SSLSocketHelper.java
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/main/java/eu/siacs/conversations/utils/SSLSocketHelper.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/utils/SSLSocketHelper.java b/src/main/java/eu/siacs/conversations/utils/SSLSocketHelper.java
index 49e9a81a..3a8c1c0a 100644
--- a/src/main/java/eu/siacs/conversations/utils/SSLSocketHelper.java
+++ b/src/main/java/eu/siacs/conversations/utils/SSLSocketHelper.java
@@ -1,11 +1,14 @@
package eu.siacs.conversations.utils;
+import android.os.Build;
+
import java.lang.reflect.Method;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedList;
+import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
@@ -59,4 +62,12 @@ public class SSLSocketHelper {
// ignore any error, we just can't set the alpn protocol...
}
}
+
+ public static SSLContext getSSLContext() throws NoSuchAlgorithmException {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
+ return SSLContext.getInstance("TLSv1.2");
+ } else {
+ return SSLContext.getInstance("TLS");
+ }
+ }
}