diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-10-20 21:22:10 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-10-20 21:22:10 +0200 |
commit | 934ee82bc6e9608055de97a792f8de5a5f3e74e5 (patch) | |
tree | 3df436c977c26b27a7235cee0d34f26247ac461d /src/main/java/de | |
parent | ec7963e9bbe8accdcda050f24b06a63c01ac1ae2 (diff) |
catch exception if Conscrypt could not be initialized and use tls 1.2
Diffstat (limited to 'src/main/java/de')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 6 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/utils/SSLSocketHelper.java | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 289823f79..df871dd83 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -1091,7 +1091,11 @@ public class XmppConnectionService extends Service { public void onCreate() { OmemoSetting.load(this); ExceptionHelper.init(getApplicationContext()); - Security.insertProviderAt(Conscrypt.newProvider(), 1); + try { + Security.insertProviderAt(Conscrypt.newProvider(), 1); + } catch (Throwable throwable) { + Log.e(Config.LOGTAG, "unable to initialize security provider", throwable); + } Resolver.init(this); this.mRandom = new SecureRandom(); updateMemorizingTrustmanager(); diff --git a/src/main/java/de/pixart/messenger/utils/SSLSocketHelper.java b/src/main/java/de/pixart/messenger/utils/SSLSocketHelper.java index 5a1e97551..ce8aa009f 100644 --- a/src/main/java/de/pixart/messenger/utils/SSLSocketHelper.java +++ b/src/main/java/de/pixart/messenger/utils/SSLSocketHelper.java @@ -90,7 +90,11 @@ public class SSLSocketHelper { } public static SSLContext getSSLContext() throws NoSuchAlgorithmException { - return SSLContext.getInstance("TLSv1.3"); + try { + return SSLContext.getInstance("TLSv1.3"); + } catch (NoSuchAlgorithmException e) { + return SSLContext.getInstance("TLSv1.2"); + } } public static void log(Account account, SSLSocket socket) { |