blob: abc6466e6d1535a9056efe92514c24605584e3a1 [file] [log] [blame]
Andres Morales8fa56652015-03-31 09:19:50 -07001/*
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.service.gatekeeper;
18
Andres Morales23974272015-05-14 22:42:26 -070019import android.service.gatekeeper.GateKeeperResponse;
20
Andres Morales8fa56652015-03-31 09:19:50 -070021/**
22 * Interface for communication with GateKeeper, the
23 * secure password storage daemon.
24 *
25 * This must be kept manually in sync with system/core/gatekeeperd
26 * until AIDL can generate both C++ and Java bindings.
27 *
28 * @hide
29 */
30interface IGateKeeperService {
31 /**
32 * Enrolls a password, returning the handle to the enrollment to be stored locally.
33 * @param uid The Android user ID associated to this enrollment
34 * @param currentPasswordHandle The previously enrolled handle, or null if none
35 * @param currentPassword The previously enrolled plaintext password, or null if none.
36 * If provided, must verify against the currentPasswordHandle.
37 * @param desiredPassword The new desired password, for which a handle will be returned
38 * upon success.
Andres Morales23974272015-05-14 22:42:26 -070039 * @return an EnrollResponse or null on failure
Andres Morales8fa56652015-03-31 09:19:50 -070040 */
Andres Morales23974272015-05-14 22:42:26 -070041 GateKeeperResponse enroll(int uid, in byte[] currentPasswordHandle, in byte[] currentPassword,
Andres Morales8fa56652015-03-31 09:19:50 -070042 in byte[] desiredPassword);
43
44 /**
45 * Verifies an enrolled handle against a provided, plaintext blob.
46 * @param uid The Android user ID associated to this enrollment
47 * @param enrolledPasswordHandle The handle against which the provided password will be
48 * verified.
49 * @param The plaintext blob to verify against enrolledPassword.
Andres Morales23974272015-05-14 22:42:26 -070050 * @return a VerifyResponse, or null on failure.
Andres Morales8fa56652015-03-31 09:19:50 -070051 */
Andres Morales23974272015-05-14 22:42:26 -070052 GateKeeperResponse verify(int uid, in byte[] enrolledPasswordHandle, in byte[] providedPassword);
53
Andres Moralesd9fc85a2015-04-09 19:14:42 -070054 /**
55 * Verifies an enrolled handle against a provided, plaintext blob.
56 * @param uid The Android user ID associated to this enrollment
57 * @param challenge a challenge to authenticate agaisnt the device credential. If successful
Andres Moralesca38add2015-04-16 13:03:42 -070058 * authentication occurs, this value will be written to the returned
Andres Moralesd9fc85a2015-04-09 19:14:42 -070059 * authentication attestation.
60 * @param enrolledPasswordHandle The handle against which the provided password will be
61 * verified.
62 * @param The plaintext blob to verify against enrolledPassword.
Andres Morales23974272015-05-14 22:42:26 -070063 * @return a VerifyResponse with an attestation, or null on failure.
Andres Moralesd9fc85a2015-04-09 19:14:42 -070064 */
Andres Morales23974272015-05-14 22:42:26 -070065 GateKeeperResponse verifyChallenge(int uid, long challenge, in byte[] enrolledPasswordHandle,
Andres Moralesd9fc85a2015-04-09 19:14:42 -070066 in byte[] providedPassword);
Andres Moralesca38add2015-04-16 13:03:42 -070067
68 /**
69 * Retrieves the secure identifier for the user with the provided Android ID,
70 * or 0 if none is found.
71 * @param uid the Android user id
72 */
73 long getSecureUserId(int uid);
Andres Moralescfb61602015-04-16 16:31:15 -070074
75 /**
76 * Clears secure user id associated with the provided Android ID.
77 * Must be called when password is set to NONE.
78 * @param uid the Android user id.
79 */
80 void clearSecureUserId(int uid);
Adrian Roos7374d3a2017-03-31 14:14:53 -070081
82 /**
83 * Notifies gatekeeper that device setup has been completed and any potentially still existing
84 * state from before a factory reset can be cleaned up (if it has not been already).
85 */
86 void reportDeviceSetupComplete();
Andres Morales8fa56652015-03-31 09:19:50 -070087}