Chad Brubaker | 7a2c973 | 2015-01-13 17:41:22 -0800 | [diff] [blame] | 1 | /** |
| 2 | * Copyright (c) 2015, The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.security; |
| 18 | |
Chad Brubaker | 45ff13e | 2015-01-21 14:00:55 -0800 | [diff] [blame] | 19 | import android.security.keymaster.ExportResult; |
| 20 | import android.security.keymaster.KeyCharacteristics; |
| 21 | import android.security.keymaster.KeymasterArguments; |
Chad Brubaker | 5e73c0e | 2015-03-21 22:46:43 -0700 | [diff] [blame] | 22 | import android.security.keymaster.KeymasterBlob; |
Chad Brubaker | 45ff13e | 2015-01-21 14:00:55 -0800 | [diff] [blame] | 23 | import android.security.keymaster.OperationResult; |
Chad Brubaker | 7a2c973 | 2015-01-13 17:41:22 -0800 | [diff] [blame] | 24 | import android.security.KeystoreArguments; |
| 25 | |
| 26 | /** |
| 27 | * This must be kept manually in sync with system/security/keystore until AIDL |
| 28 | * can generate both Java and C++ bindings. |
| 29 | * |
| 30 | * @hide |
| 31 | */ |
| 32 | interface IKeystoreService { |
Chad Brubaker | d8aacca | 2015-05-12 15:19:52 -0700 | [diff] [blame] | 33 | int getState(int userId); |
Chad Brubaker | 5bbf048 | 2015-09-09 14:53:52 -0700 | [diff] [blame^] | 34 | byte[] get(String name, int uid); |
Chad Brubaker | 7a2c973 | 2015-01-13 17:41:22 -0800 | [diff] [blame] | 35 | int insert(String name, in byte[] item, int uid, int flags); |
| 36 | int del(String name, int uid); |
| 37 | int exist(String name, int uid); |
Chad Brubaker | d8aacca | 2015-05-12 15:19:52 -0700 | [diff] [blame] | 38 | String[] list(String namePrefix, int uid); |
Chad Brubaker | 7a2c973 | 2015-01-13 17:41:22 -0800 | [diff] [blame] | 39 | int reset(); |
Chad Brubaker | d88fffa | 2015-05-07 10:02:22 -0700 | [diff] [blame] | 40 | int onUserPasswordChanged(int userId, String newPassword); |
Chad Brubaker | d8aacca | 2015-05-12 15:19:52 -0700 | [diff] [blame] | 41 | int lock(int userId); |
Chad Brubaker | d88fffa | 2015-05-07 10:02:22 -0700 | [diff] [blame] | 42 | int unlock(int userId, String userPassword); |
Chad Brubaker | d8aacca | 2015-05-12 15:19:52 -0700 | [diff] [blame] | 43 | int isEmpty(int userId); |
Chad Brubaker | 7a2c973 | 2015-01-13 17:41:22 -0800 | [diff] [blame] | 44 | int generate(String name, int uid, int keyType, int keySize, int flags, |
| 45 | in KeystoreArguments args); |
| 46 | int import_key(String name, in byte[] data, int uid, int flags); |
| 47 | byte[] sign(String name, in byte[] data); |
| 48 | int verify(String name, in byte[] data, in byte[] signature); |
| 49 | byte[] get_pubkey(String name); |
Chad Brubaker | 7a2c973 | 2015-01-13 17:41:22 -0800 | [diff] [blame] | 50 | int grant(String name, int granteeUid); |
| 51 | int ungrant(String name, int granteeUid); |
Chad Brubaker | 5bbf048 | 2015-09-09 14:53:52 -0700 | [diff] [blame^] | 52 | long getmtime(String name, int uid); |
Chad Brubaker | 7a2c973 | 2015-01-13 17:41:22 -0800 | [diff] [blame] | 53 | int duplicate(String srcKey, int srcUid, String destKey, int destUid); |
| 54 | int is_hardware_backed(String string); |
| 55 | int clear_uid(long uid); |
Chad Brubaker | 45ff13e | 2015-01-21 14:00:55 -0800 | [diff] [blame] | 56 | |
| 57 | // Keymaster 0.4 methods |
| 58 | int addRngEntropy(in byte[] data); |
Chad Brubaker | dae79e5 | 2015-03-27 14:28:35 -0700 | [diff] [blame] | 59 | int generateKey(String alias, in KeymasterArguments arguments, in byte[] entropy, int uid, |
| 60 | int flags, out KeyCharacteristics characteristics); |
Chad Brubaker | 5e73c0e | 2015-03-21 22:46:43 -0700 | [diff] [blame] | 61 | int getKeyCharacteristics(String alias, in KeymasterBlob clientId, in KeymasterBlob appId, |
Chad Brubaker | 5bbf048 | 2015-09-09 14:53:52 -0700 | [diff] [blame^] | 62 | int uid, out KeyCharacteristics characteristics); |
Chad Brubaker | 45ff13e | 2015-01-21 14:00:55 -0800 | [diff] [blame] | 63 | int importKey(String alias, in KeymasterArguments arguments, int format, |
| 64 | in byte[] keyData, int uid, int flags, out KeyCharacteristics characteristics); |
Chad Brubaker | 5e73c0e | 2015-03-21 22:46:43 -0700 | [diff] [blame] | 65 | ExportResult exportKey(String alias, int format, in KeymasterBlob clientId, |
Chad Brubaker | 5bbf048 | 2015-09-09 14:53:52 -0700 | [diff] [blame^] | 66 | in KeymasterBlob appId, int uid); |
Chad Brubaker | 45ff13e | 2015-01-21 14:00:55 -0800 | [diff] [blame] | 67 | OperationResult begin(IBinder appToken, String alias, int purpose, boolean pruneable, |
Chad Brubaker | 5bbf048 | 2015-09-09 14:53:52 -0700 | [diff] [blame^] | 68 | in KeymasterArguments params, in byte[] entropy, int uid); |
Chad Brubaker | 45ff13e | 2015-01-21 14:00:55 -0800 | [diff] [blame] | 69 | OperationResult update(IBinder token, in KeymasterArguments params, in byte[] input); |
Chad Brubaker | 9ce3062 | 2015-05-29 12:32:51 -0700 | [diff] [blame] | 70 | OperationResult finish(IBinder token, in KeymasterArguments params, in byte[] signature, |
| 71 | in byte[] entropy); |
Chad Brubaker | 45ff13e | 2015-01-21 14:00:55 -0800 | [diff] [blame] | 72 | int abort(IBinder handle); |
Chad Brubaker | 5654b36 | 2015-03-17 16:59:52 -0700 | [diff] [blame] | 73 | boolean isOperationAuthorized(IBinder token); |
| 74 | int addAuthToken(in byte[] authToken); |
Chad Brubaker | 31c2897 | 2015-05-12 13:00:02 -0700 | [diff] [blame] | 75 | int onUserAdded(int userId, int parentId); |
| 76 | int onUserRemoved(int userId); |
Chad Brubaker | 7a2c973 | 2015-01-13 17:41:22 -0800 | [diff] [blame] | 77 | } |