mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 05:35:39 +03:00
use conscrypt
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
468899522e
commit
6014e90df7
2 changed files with 28 additions and 0 deletions
|
@ -303,6 +303,7 @@ dependencies {
|
|||
annotationProcessor "org.projectlombok:lombok:1.18.8"
|
||||
|
||||
ktlint "com.pinterest:ktlint:0.34.2"
|
||||
implementation 'org.conscrypt:conscrypt-android:2.2.1'
|
||||
|
||||
// dependencies for local unit tests
|
||||
testImplementation 'junit:junit:4.12'
|
||||
|
|
|
@ -79,14 +79,21 @@ import com.owncloud.android.utils.PermissionUtil;
|
|||
import com.owncloud.android.utils.ReceiversHelper;
|
||||
import com.owncloud.android.utils.SecurityUtils;
|
||||
|
||||
import org.conscrypt.Conscrypt;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.Security;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.SSLEngine;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.annotation.StringRes;
|
||||
|
@ -218,6 +225,8 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
|
|||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
insertConscrypt();
|
||||
|
||||
SecurityKeyManager securityKeyManager = SecurityKeyManager.getInstance();
|
||||
SecurityKeyManagerConfig config = new SecurityKeyManagerConfig.Builder()
|
||||
.setEnableDebugLogging(BuildConfig.DEBUG)
|
||||
|
@ -345,7 +354,25 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
|
|||
ContactsPreferenceActivity.startContactBackupJob(account);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void insertConscrypt() {
|
||||
Security.insertProviderAt(Conscrypt.newProvider(), 1);
|
||||
|
||||
try {
|
||||
Conscrypt.Version version = Conscrypt.version();
|
||||
Log_OC.i(TAG, "Using Conscrypt/"
|
||||
+ version.major()
|
||||
+ "."
|
||||
+ version.minor()
|
||||
+ "." + version.patch()
|
||||
+ " for TLS");
|
||||
SSLEngine engine = SSLContext.getDefault().createSSLEngine();
|
||||
Log_OC.i(TAG, "Enabled protocols: " + Arrays.toString(engine.getEnabledProtocols()) + " }");
|
||||
Log_OC.i(TAG, "Enabled ciphers: " + Arrays.toString(engine.getEnabledCipherSuites()) + " }");
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
Log_OC.e(TAG, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("ApplySharedPref") // commit is done on purpose to write immediately
|
||||
|
|
Loading…
Reference in a new issue