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

Commit 6c03bf52 authored by Alex Klyubin's avatar Alex Klyubin
Browse files

Streamline Android Keystore delete entry operation.

This ensures that all four entry subtypes are deleted.

Bug: 18088752
Change-Id: Ia020dbede562a123c8c81cc9449ba5ab4aac61dd
parent cb9400aa
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -674,12 +674,13 @@ public class AndroidKeyStoreSpi extends KeyStoreSpi {

    @Override
    public void engineDeleteEntry(String alias) throws KeyStoreException {
        if (!isKeyEntry(alias) && !isCertificateEntry(alias)) {
        if (!engineContainsAlias(alias)) {
            return;
        }
        // At least one entry corresponding to this alias exists in keystore

        if (!Credentials.deleteAllTypesForAlias(mKeyStore, alias)) {
            throw new KeyStoreException("No such entry " + alias);
            throw new KeyStoreException("Failed to delete entry: " + alias);
        }
    }

@@ -849,9 +850,7 @@ public class AndroidKeyStoreSpi extends KeyStoreSpi {
            throw new KeyStoreException("entry == null");
        }

        if (engineContainsAlias(alias)) {
            engineDeleteEntry(alias);
        }
        Credentials.deleteAllTypesForAlias(mKeyStore, alias);

        if (entry instanceof KeyStore.TrustedCertificateEntry) {
            KeyStore.TrustedCertificateEntry trE = (KeyStore.TrustedCertificateEntry) entry;