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

Commit df6c6702 authored by Alex Klyubin's avatar Alex Klyubin Committed by Android (Google) Code Review
Browse files

Merge "Streamline Android Keystore delete entry operation." into mnc-dev

parents b070e486 6c03bf52
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;