am 28d99c24: am df6c6702: Merge "Streamline Android Keystore delete entry operation." into mnc-dev
* commit '28d99c2419d0b8f472fe45bb31d1ffbde61145e0':
Streamline Android Keystore delete entry operation.
diff --git a/keystore/java/android/security/keystore/AndroidKeyStoreSpi.java b/keystore/java/android/security/keystore/AndroidKeyStoreSpi.java
index 701bd67..05ddef6 100644
--- a/keystore/java/android/security/keystore/AndroidKeyStoreSpi.java
+++ b/keystore/java/android/security/keystore/AndroidKeyStoreSpi.java
@@ -674,12 +674,13 @@
@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 @@
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;