blob: 641e1ada6eaa2382a0866779769c353fe4d764b1 [file] [log] [blame]
Chad Brubaker7a2c9732015-01-13 17:41:22 -08001/**
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
17package android.security;
18
Chad Brubaker45ff13e2015-01-21 14:00:55 -080019import android.security.keymaster.ExportResult;
20import android.security.keymaster.KeyCharacteristics;
21import android.security.keymaster.KeymasterArguments;
Shawn Willden8d8c7472016-02-02 08:27:39 -070022import android.security.keymaster.KeymasterCertificateChain;
Chad Brubaker5e73c0e2015-03-21 22:46:43 -070023import android.security.keymaster.KeymasterBlob;
Chad Brubaker45ff13e2015-01-21 14:00:55 -080024import android.security.keymaster.OperationResult;
Chad Brubaker7a2c9732015-01-13 17:41:22 -080025import android.security.KeystoreArguments;
26
27/**
28 * This must be kept manually in sync with system/security/keystore until AIDL
29 * can generate both Java and C++ bindings.
30 *
31 * @hide
32 */
33interface IKeystoreService {
Chad Brubakerd8aacca2015-05-12 15:19:52 -070034 int getState(int userId);
Chad Brubaker5bbf0482015-09-09 14:53:52 -070035 byte[] get(String name, int uid);
Chad Brubaker7a2c9732015-01-13 17:41:22 -080036 int insert(String name, in byte[] item, int uid, int flags);
37 int del(String name, int uid);
38 int exist(String name, int uid);
Chad Brubakerd8aacca2015-05-12 15:19:52 -070039 String[] list(String namePrefix, int uid);
Chad Brubaker7a2c9732015-01-13 17:41:22 -080040 int reset();
Chad Brubakerd88fffa2015-05-07 10:02:22 -070041 int onUserPasswordChanged(int userId, String newPassword);
Chad Brubakerd8aacca2015-05-12 15:19:52 -070042 int lock(int userId);
Chad Brubakerd88fffa2015-05-07 10:02:22 -070043 int unlock(int userId, String userPassword);
Chad Brubakerd8aacca2015-05-12 15:19:52 -070044 int isEmpty(int userId);
Chad Brubaker7a2c9732015-01-13 17:41:22 -080045 int generate(String name, int uid, int keyType, int keySize, int flags,
46 in KeystoreArguments args);
47 int import_key(String name, in byte[] data, int uid, int flags);
48 byte[] sign(String name, in byte[] data);
49 int verify(String name, in byte[] data, in byte[] signature);
50 byte[] get_pubkey(String name);
Chad Brubaker7a2c9732015-01-13 17:41:22 -080051 int grant(String name, int granteeUid);
52 int ungrant(String name, int granteeUid);
Chad Brubaker5bbf0482015-09-09 14:53:52 -070053 long getmtime(String name, int uid);
Chad Brubaker7a2c9732015-01-13 17:41:22 -080054 int duplicate(String srcKey, int srcUid, String destKey, int destUid);
55 int is_hardware_backed(String string);
56 int clear_uid(long uid);
Chad Brubaker45ff13e2015-01-21 14:00:55 -080057
58 // Keymaster 0.4 methods
59 int addRngEntropy(in byte[] data);
Chad Brubakerdae79e52015-03-27 14:28:35 -070060 int generateKey(String alias, in KeymasterArguments arguments, in byte[] entropy, int uid,
61 int flags, out KeyCharacteristics characteristics);
Chad Brubaker5e73c0e2015-03-21 22:46:43 -070062 int getKeyCharacteristics(String alias, in KeymasterBlob clientId, in KeymasterBlob appId,
Chad Brubaker5bbf0482015-09-09 14:53:52 -070063 int uid, out KeyCharacteristics characteristics);
Chad Brubaker45ff13e2015-01-21 14:00:55 -080064 int importKey(String alias, in KeymasterArguments arguments, int format,
65 in byte[] keyData, int uid, int flags, out KeyCharacteristics characteristics);
Chad Brubaker5e73c0e2015-03-21 22:46:43 -070066 ExportResult exportKey(String alias, int format, in KeymasterBlob clientId,
Chad Brubaker5bbf0482015-09-09 14:53:52 -070067 in KeymasterBlob appId, int uid);
Chad Brubaker45ff13e2015-01-21 14:00:55 -080068 OperationResult begin(IBinder appToken, String alias, int purpose, boolean pruneable,
Chad Brubaker5bbf0482015-09-09 14:53:52 -070069 in KeymasterArguments params, in byte[] entropy, int uid);
Chad Brubaker45ff13e2015-01-21 14:00:55 -080070 OperationResult update(IBinder token, in KeymasterArguments params, in byte[] input);
Chad Brubaker9ce30622015-05-29 12:32:51 -070071 OperationResult finish(IBinder token, in KeymasterArguments params, in byte[] signature,
72 in byte[] entropy);
Chad Brubaker45ff13e2015-01-21 14:00:55 -080073 int abort(IBinder handle);
Chad Brubaker5654b362015-03-17 16:59:52 -070074 boolean isOperationAuthorized(IBinder token);
75 int addAuthToken(in byte[] authToken);
Chad Brubaker31c28972015-05-12 13:00:02 -070076 int onUserAdded(int userId, int parentId);
77 int onUserRemoved(int userId);
Shawn Willden8d8c7472016-02-02 08:27:39 -070078 int attestKey(String alias, in KeymasterArguments params, out KeymasterCertificateChain chain);
Tucker Sylvestrob32aae22016-06-23 17:23:33 -040079 int onDeviceOffBody();
Chad Brubaker7a2c9732015-01-13 17:41:22 -080080}