mirror of https://github.com/M66B/FairEmail.git
Update system BC provider
This commit is contained in:
parent
1e00b1a895
commit
3371812b71
|
@ -42,6 +42,10 @@ import androidx.annotation.Nullable;
|
|||
import androidx.preference.PreferenceManager;
|
||||
import androidx.work.WorkManager;
|
||||
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
|
||||
import java.security.Provider;
|
||||
import java.security.Security;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
|
@ -51,6 +55,22 @@ public class ApplicationEx extends Application
|
|||
implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
private Thread.UncaughtExceptionHandler prev = null;
|
||||
|
||||
static {
|
||||
try {
|
||||
Provider[] providers = Security.getProviders();
|
||||
for (int p = 0; p < providers.length; p++)
|
||||
if (BouncyCastleProvider.PROVIDER_NAME.equals(providers[p].getName())) {
|
||||
Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME);
|
||||
Provider bc = new BouncyCastleProvider();
|
||||
Security.insertProviderAt(bc, p + 1);
|
||||
Log.i("Replacing provider " + providers[p] + " at " + p + " by " + bc);
|
||||
break;
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(getLocalizedContext(base));
|
||||
|
|
Loading…
Reference in New Issue