diff --git a/android/build.gradle b/android/build.gradle index d65a34e..b0c54b1 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -23,7 +23,7 @@ apply plugin: 'com.android.application' android { compileSdkVersion 29 defaultConfig { - minSdkVersion 23 + minSdkVersion 22 targetSdkVersion 29 versionCode 16 versionName System.getenv("VERSION") @@ -38,6 +38,6 @@ dependencies { implementation 'com.google.android.gms:play-services-auth:18.0.0' implementation "androidx.core:core:1.2.0" implementation "androidx.browser:browser:1.2.0" - implementation "androidx.security:security-crypto:1.0.0-rc01" + implementation "androidx.security:security-crypto:1.1.0-alpha02" implementation ':ipn@aar' } diff --git a/android/src/main/java/com/tailscale/ipn/App.java b/android/src/main/java/com/tailscale/ipn/App.java index 8a69580..d224f86 100644 --- a/android/src/main/java/com/tailscale/ipn/App.java +++ b/android/src/main/java/com/tailscale/ipn/App.java @@ -25,7 +25,7 @@ import java.io.FileOutputStream; import java.security.GeneralSecurityException; import androidx.security.crypto.EncryptedSharedPreferences; -import androidx.security.crypto.MasterKeys; +import androidx.security.crypto.MasterKey; import org.gioui.Gio; @@ -72,12 +72,14 @@ public class App extends Application { } private SharedPreferences getEncryptedPrefs() throws IOException, GeneralSecurityException { - String masterKeyAlias = MasterKeys.getOrCreate(MasterKeys.AES256_GCM_SPEC); + MasterKey key = new MasterKey.Builder(this) + .setKeyScheme(MasterKey.KeyScheme.AES256_GCM) + .build(); return EncryptedSharedPreferences.create( - "secret_shared_prefs", - masterKeyAlias, this, + "secret_shared_prefs", + key, EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV, EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM );