diff options
author | Alex Klyubin <klyubin@google.com> | 2015-06-04 11:36:26 -0700 |
---|---|---|
committer | Alex Klyubin <klyubin@google.com> | 2015-06-04 11:36:26 -0700 |
commit | 6c03bf523d6b0e4edfade726ed0ee1c49c4d0f69 (patch) | |
tree | 0b7b4541bf73c999b79639f513748c8990fd0961 /keystore/java | |
parent | cb9400aa23b81f12d8af198187fc799d6bcf164a (diff) | |
download | frameworks_base-6c03bf523d6b0e4edfade726ed0ee1c49c4d0f69.zip frameworks_base-6c03bf523d6b0e4edfade726ed0ee1c49c4d0f69.tar.gz frameworks_base-6c03bf523d6b0e4edfade726ed0ee1c49c4d0f69.tar.bz2 |
Streamline Android Keystore delete entry operation.
This ensures that all four entry subtypes are deleted.
Bug: 18088752
Change-Id: Ia020dbede562a123c8c81cc9449ba5ab4aac61dd
Diffstat (limited to 'keystore/java')
-rw-r--r-- | keystore/java/android/security/keystore/AndroidKeyStoreSpi.java | 9 |
1 files changed, 4 insertions, 5 deletions
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 @@ 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; |