summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author John Wu <topjohnwu@google.com> 2022-01-19 01:13:31 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2022-01-19 01:13:31 +0000
commit1c632f80e870bf78f5dedb79233f7c338f97b12d (patch)
tree7fa2df9a6a22f0aa7778ee7a13f263fe8753f9e6
parent8ddb283a68f27b5fe47c2a3074e62ec8aba8934a (diff)
parent253c91192fdda00f2c34c029e100b06b9fc4f4d6 (diff)
Merge "Update AndroidKeyStoreMaintenance framework API" am: 8c34efd29a am: be201a0ed5 am: 7d7010dcf8 am: 253c91192f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1950401 Change-Id: I8b3f892d829decc104ef2a732af5fbbfa3e08fa8
-rw-r--r--keystore/java/android/security/AndroidKeyStoreMaintenance.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/keystore/java/android/security/AndroidKeyStoreMaintenance.java b/keystore/java/android/security/AndroidKeyStoreMaintenance.java
index 919a93b8f107..05fb4c3cf76f 100644
--- a/keystore/java/android/security/AndroidKeyStoreMaintenance.java
+++ b/keystore/java/android/security/AndroidKeyStoreMaintenance.java
@@ -20,6 +20,7 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.os.ServiceManager;
import android.os.ServiceSpecificException;
+import android.security.keystore.KeyProperties;
import android.security.maintenance.IKeystoreMaintenance;
import android.system.keystore2.Domain;
import android.system.keystore2.KeyDescriptor;
@@ -157,6 +158,11 @@ public class AndroidKeyStoreMaintenance {
* Migrates a key given by the source descriptor to the location designated by the destination
* descriptor.
*
+ * If Domain::APP is selected in either source or destination, nspace must be set to
+ * {@link KeyProperties#NAMESPACE_APPLICATION}, implying the caller's UID.
+ * If the caller has the MIGRATE_ANY_KEY permission, Domain::APP may be used with
+ * other nspace values which then indicates the UID of a different application.
+ *
* @param source - The key to migrate may be specified by Domain.APP, Domain.SELINUX, or
* Domain.KEY_ID. The caller needs the permissions use, delete, and grant for the
* source namespace.
@@ -183,4 +189,20 @@ public class AndroidKeyStoreMaintenance {
return SYSTEM_ERROR;
}
}
+
+ /**
+ * @see IKeystoreMaintenance#listEntries(int, long)
+ */
+ @Nullable
+ public static KeyDescriptor[] listEntries(int domain, long nspace) {
+ try {
+ return getService().listEntries(domain, nspace);
+ } catch (ServiceSpecificException e) {
+ Log.e(TAG, "listEntries failed", e);
+ return null;
+ } catch (Exception e) {
+ Log.e(TAG, "Can not connect to keystore", e);
+ return null;
+ }
+ }
}