Keystore 2.0: Clear Uid/Namesapce

Implement uid/namespace clearing for Keystore 2.0.

Test: Verified that keys get deleted when an app gets uninstalled.
Change-Id: I1b0b65e977177a6e34c500b00b5070ec18be2671
This commit is contained in:
Janis Danisevskis
2021-02-22 21:39:34 -08:00
parent ae6583b34f
commit d5dd5ebaed
2 changed files with 26 additions and 3 deletions

View File

@@ -43,6 +43,7 @@ import android.security.keystore.KeyPermanentlyInvalidatedException;
import android.security.keystore.KeyProperties;
import android.security.keystore.KeystoreResponse;
import android.security.keystore.UserNotAuthenticatedException;
import android.system.keystore2.Domain;
import android.util.Log;
import com.android.internal.org.bouncycastle.asn1.ASN1InputStream;
@@ -466,6 +467,9 @@ public class KeyStore {
public boolean clearUid(int uid) {
try {
if (android.security.keystore2.AndroidKeyStoreProvider.isInstalled()) {
return AndroidKeyStoreMaintenance.clearNamespace(Domain.APP, uid) == 0;
}
return mBinder.clear_uid(uid) == NO_ERROR;
} catch (RemoteException e) {
Log.w(TAG, "Cannot connect to keystore", e);