diff --git a/securedpreferencestore/src/main/java/devliving/online/securedpreferencestore/EncryptionManager.java b/securedpreferencestore/src/main/java/devliving/online/securedpreferencestore/EncryptionManager.java index 0d48b5b..a744498 100644 --- a/securedpreferencestore/src/main/java/devliving/online/securedpreferencestore/EncryptionManager.java +++ b/securedpreferencestore/src/main/java/devliving/online/securedpreferencestore/EncryptionManager.java @@ -8,14 +8,12 @@ import android.security.keystore.KeyGenParameterSpec; import android.security.keystore.KeyProperties; import android.support.annotation.Nullable; -import android.support.annotation.RequiresApi; import android.util.Base64; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.io.FileInputStream; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.math.BigInteger; @@ -687,10 +685,7 @@ byte[] decryptAESCompat(EncryptedData encryptedData) throws UnsupportedEncodingE void loadKey(SharedPreferences prefStore) throws KeyStoreException, UnrecoverableEntryException, NoSuchAlgorithmException, NoSuchPaddingException, NoSuchProviderException, InvalidKeyException, IOException { if (!isCompatMode) { - if (mStore.containsAlias(AES_KEY_ALIAS) && mStore.entryInstanceOf(AES_KEY_ALIAS, KeyStore.SecretKeyEntry.class)) { - KeyStore.SecretKeyEntry entry = (KeyStore.SecretKeyEntry) mStore.getEntry(AES_KEY_ALIAS, null); - aesKey = entry.getSecretKey(); - } + aesKey = (SecretKey) mStore.getKey(AES_KEY_ALIAS, null); } else { aesKey = getFallbackAESKey(prefStore); macKey = getMacKey(prefStore);