aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/com/zeapo/pwdstore/Application.kt
diff options
context:
space:
mode:
authorFabian Henneke <FabianHenneke@users.noreply.github.com>2020-06-23 15:39:44 +0200
committerGitHub <noreply@github.com>2020-06-23 15:39:44 +0200
commite1f81e8f4b56246706564680f4ab5d6d10f2561e (patch)
tree331a326eccb1c1460283914565aee51542cf770a /app/src/main/java/com/zeapo/pwdstore/Application.kt
parenteb31385102f38ed3c378b210650d4c8dd1785ff8 (diff)
downloadHardenedPass-e1f81e8f4b56246706564680f4ab5d6d10f2561e.tar.gz
HardenedPass-e1f81e8f4b56246706564680f4ab5d6d10f2561e.zip
Use a custom sshj config (#878)
* Use a custom sshj config * Get random numbers directly from SecureRandom * Use Timber calls for logging * Remove all algorithms that are not in the Mozilla Intermediate SSH config * Address review comments * Fixup slf4j's custom format string format Co-authored-by: Harsh Shandilya <msfjarvis@gmail.com>
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/Application.kt')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/Application.kt24
1 files changed, 2 insertions, 22 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/Application.kt b/app/src/main/java/com/zeapo/pwdstore/Application.kt
index b0c4eec0..c66c6486 100644
--- a/app/src/main/java/com/zeapo/pwdstore/Application.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/Application.kt
@@ -13,8 +13,7 @@ import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES
import androidx.preference.PreferenceManager
import com.github.ajalt.timberkt.Timber.DebugTree
import com.github.ajalt.timberkt.Timber.plant
-import org.bouncycastle.jce.provider.BouncyCastleProvider
-import java.security.Security
+import com.zeapo.pwdstore.git.config.setUpBouncyCastleForSshj
@Suppress("Unused")
class Application : android.app.Application(), SharedPreferences.OnSharedPreferenceChangeListener {
@@ -29,7 +28,7 @@ class Application : android.app.Application(), SharedPreferences.OnSharedPrefere
}
prefs?.registerOnSharedPreferenceChangeListener(this)
setNightMode()
- setUpBouncyCastle()
+ setUpBouncyCastleForSshj()
}
override fun onTerminate() {
@@ -43,25 +42,6 @@ class Application : android.app.Application(), SharedPreferences.OnSharedPrefere
}
}
- private fun setUpBouncyCastle() {
- // Replace the Android BC provider with the Java BouncyCastle provider since the former does
- // not include all the required algorithms.
- // TODO: Verify that we are indeed using the fast Android-native implementation whenever
- // possible.
- // Note: This may affect crypto operations in other parts of the application.
- val bcIndex = Security.getProviders().indexOfFirst {
- it.name == BouncyCastleProvider.PROVIDER_NAME
- }
- if (bcIndex == -1) {
- // No Android BC found, install Java BC at lowest priority.
- Security.addProvider(BouncyCastleProvider())
- } else {
- // Replace Android BC with Java BC, inserted at the same position.
- Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME)
- Security.insertProviderAt(BouncyCastleProvider(), bcIndex + 1)
- }
- }
-
private fun setNightMode() {
AppCompatDelegate.setDefaultNightMode(when (prefs?.getString("app_theme", getString(R.string.app_theme_def))) {
"light" -> MODE_NIGHT_NO