fix: don't put encrypted in encrypted

This commit is contained in:
Harris 2021-06-07 15:23:20 +10:00
parent 596b02cfaf
commit f10a99ce41

View File

@ -138,11 +138,11 @@ public class IdentityKeyUtil {
Editor preferencesEditor = preferences.edit(); Editor preferencesEditor = preferences.edit();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
KeyStoreHelper.SealedData encryptedSecret = KeyStoreHelper.seal(value.getBytes());
boolean isEncryptedSuffix = key.endsWith(ENCRYPTED_SUFFIX); boolean isEncryptedSuffix = key.endsWith(ENCRYPTED_SUFFIX);
if (isEncryptedSuffix) { if (isEncryptedSuffix) {
preferencesEditor.putString(key, encryptedSecret.serialize()); preferencesEditor.putString(key, value);
} else { } else {
KeyStoreHelper.SealedData encryptedSecret = KeyStoreHelper.seal(value.getBytes());
preferencesEditor.putString(key+ENCRYPTED_SUFFIX, encryptedSecret.serialize()); preferencesEditor.putString(key+ENCRYPTED_SUFFIX, encryptedSecret.serialize());
} }
} else { } else {