summaryrefslogtreecommitdiffstats
path: root/keystore
diff options
context:
space:
mode:
authorChad Brubaker <cbrubaker@google.com>2015-03-17 16:59:52 -0700
committerChad Brubaker <cbrubaker@google.com>2015-03-17 16:59:52 -0700
commit5654b36b4667431e49d27c07a06d275656071e75 (patch)
tree8727d12b0841df3659c695086d2e6fdfab5abe2e /keystore
parent28e6aeca3aad075ef4fd7aab08cd1ad1ff9eb555 (diff)
downloadframeworks_base-5654b36b4667431e49d27c07a06d275656071e75.zip
frameworks_base-5654b36b4667431e49d27c07a06d275656071e75.tar.gz
frameworks_base-5654b36b4667431e49d27c07a06d275656071e75.tar.bz2
Add authorization binder methods
Add methods for sending an auth token to keystore and to query the authorization state of a given operation. Change-Id: I223df5c56ae2a251ef31cfe60f06c046c12a5cd8
Diffstat (limited to 'keystore')
-rw-r--r--keystore/java/android/security/KeyStore.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/keystore/java/android/security/KeyStore.java b/keystore/java/android/security/KeyStore.java
index bfbf028..9682b4f 100644
--- a/keystore/java/android/security/KeyStore.java
+++ b/keystore/java/android/security/KeyStore.java
@@ -474,4 +474,34 @@ public class KeyStore {
return SYSTEM_ERROR;
}
}
+
+ /**
+ * Check if the operation referenced by {@code token} is currently authorized.
+ *
+ * @param token An operation token returned by a call to {@link KeyStore.begin}.
+ */
+ public boolean isOperationAuthorized(IBinder token) {
+ try {
+ return mBinder.isOperationAuthorized(token);
+ } catch (RemoteException e) {
+ Log.w(TAG, "Cannot connect to keystore", e);
+ return false;
+ }
+ }
+
+ /**
+ * Add an authentication record to the keystore authorization table.
+ *
+ * @param authToken The packed bytes of a hw_auth_token_t to be provided to keymaster.
+ * @return {@code KeyStore.NO_ERROR} on success, otherwise an error value corresponding to
+ * a {@code KeymasterDefs.KM_ERROR_} value or {@code KeyStore} ResponseCode.
+ */
+ public int addAuthToken(byte[] authToken) {
+ try {
+ return mBinder.addAuthToken(authToken);
+ } catch (RemoteException e) {
+ Log.w(TAG, "Cannot connect to keystore", e);
+ return SYSTEM_ERROR;
+ }
+ }
}