Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 254035c9 authored by Billy Huang's avatar Billy Huang
Browse files

Inject KeyStore from SyntheticPasswordCrypto

This reduces duplicated factory logic for the KeyStore needed for encryption and decryption.

Bug: 412331826
Flag: EXEMPT refactor
Test: atest LockSettingsService
Change-Id: I03e196bdc71c886be758efbd1049982cb7500e04
parent 93052efd
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -112,7 +112,6 @@ import android.security.keystore.recovery.KeyChainProtectionParams;
import android.security.keystore.recovery.KeyChainSnapshot;
import android.security.keystore.recovery.RecoveryCertPath;
import android.security.keystore.recovery.WrappedApplicationKey;
import android.security.keystore2.AndroidKeyStoreLoadStoreParameter;
import android.security.keystore2.AndroidKeyStoreProvider;
import android.service.gatekeeper.IGateKeeperService;
import android.service.notification.StatusBarNotification;
@@ -618,11 +617,7 @@ public class LockSettingsService extends ILockSettings.Stub {

        public KeyStore getKeyStore() {
            try {
                KeyStore ks = KeyStore.getInstance(
                        SyntheticPasswordCrypto.androidKeystoreProviderName());
                ks.load(new AndroidKeyStoreLoadStoreParameter(
                        SyntheticPasswordCrypto.keyNamespace()));
                return ks;
                return SyntheticPasswordCrypto.getKeyStore();
            } catch (Exception e) {
                throw new IllegalStateException("Cannot load keystore", e);
            }
+1 −1
Original line number Diff line number Diff line
@@ -155,7 +155,7 @@ class SyntheticPasswordCrypto {
        return KeyProperties.NAMESPACE_LOCKSETTINGS;
    }

    private static KeyStore getKeyStore()
    static KeyStore getKeyStore()
            throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException {
        KeyStore keyStore = KeyStore.getInstance(androidKeystoreProviderName());
        keyStore.load(new AndroidKeyStoreLoadStoreParameter(keyNamespace()));