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