|
80 | 80 | import com.owncloud.android.utils.ReceiversHelper; |
81 | 81 | import com.owncloud.android.utils.SecurityUtils; |
82 | 82 |
|
| 83 | +import org.conscrypt.Conscrypt; |
| 84 | + |
83 | 85 | import java.lang.reflect.Method; |
| 86 | +import java.security.NoSuchAlgorithmException; |
| 87 | +import java.security.Security; |
84 | 88 | import java.util.ArrayList; |
| 89 | +import java.util.Arrays; |
85 | 90 | import java.util.HashMap; |
86 | 91 | import java.util.List; |
87 | 92 | import java.util.Map; |
88 | 93 | import java.util.concurrent.TimeUnit; |
89 | 94 |
|
90 | 95 | import javax.inject.Inject; |
| 96 | +import javax.net.ssl.SSLContext; |
| 97 | +import javax.net.ssl.SSLEngine; |
91 | 98 |
|
92 | 99 | import androidx.annotation.RequiresApi; |
93 | 100 | import androidx.annotation.StringRes; |
@@ -224,6 +231,8 @@ protected void attachBaseContext(Context base) { |
224 | 231 | public void onCreate() { |
225 | 232 | super.onCreate(); |
226 | 233 |
|
| 234 | + insertConscrypt(); |
| 235 | + |
227 | 236 | SecurityKeyManager securityKeyManager = SecurityKeyManager.getInstance(); |
228 | 237 | SecurityKeyManagerConfig config = new SecurityKeyManagerConfig.Builder() |
229 | 238 | .setEnableDebugLogging(BuildConfig.DEBUG) |
@@ -350,7 +359,25 @@ public static void initContactsBackup(UserAccountManager accountManager) { |
350 | 359 | ContactsPreferenceActivity.startContactBackupJob(account); |
351 | 360 | } |
352 | 361 | } |
| 362 | + } |
353 | 363 |
|
| 364 | + private void insertConscrypt() { |
| 365 | + Security.insertProviderAt(Conscrypt.newProvider(), 1); |
| 366 | + |
| 367 | + try { |
| 368 | + Conscrypt.Version version = Conscrypt.version(); |
| 369 | + Log_OC.i(TAG, "Using Conscrypt/" |
| 370 | + + version.major() |
| 371 | + + "." |
| 372 | + + version.minor() |
| 373 | + + "." + version.patch() |
| 374 | + + " for TLS"); |
| 375 | + SSLEngine engine = SSLContext.getDefault().createSSLEngine(); |
| 376 | + Log_OC.i(TAG, "Enabled protocols: " + Arrays.toString(engine.getEnabledProtocols()) + " }"); |
| 377 | + Log_OC.i(TAG, "Enabled ciphers: " + Arrays.toString(engine.getEnabledCipherSuites()) + " }"); |
| 378 | + } catch (NoSuchAlgorithmException e) { |
| 379 | + Log_OC.e(TAG, e.getMessage()); |
| 380 | + } |
354 | 381 | } |
355 | 382 |
|
356 | 383 | @SuppressLint("ApplySharedPref") // commit is done on purpose to write immediately |
|
0 commit comments