1/* 2 * Copyright (C) 2016 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 */ 16package android.hardware.gatekeeper@1.0; 17 18@SensitiveData 19interface IGatekeeper { 20 21/** 22 * Enrolls desiredPassword, which may be derived from a user selected pin 23 * or password, with the private key used only for enrolling authentication 24 * factor data. 25 * 26 * If there was already a password enrolled, current password handle must be 27 * passed in currentPasswordHandle, and current password must be passed in 28 * currentPassword. Valid currentPassword must verify() against 29 * currentPasswordHandle. 30 * 31 * @param uid The Android user identifier 32 * 33 * @param currentPasswordHandle The currently enrolled password handle the user 34 * wants to replace. May be empty only if there's no currently enrolled 35 * password. Otherwise must be non-empty. 36 * 37 * @param currentPassword The user's current password in plain text. 38 * it MUST verify against current_password_handle if the latter is not-empty 39 * 40 * @param desiredPassword The new password the user wishes to enroll in 41 * plaintext. 42 * 43 * @return response 44 * On success, data buffer must contain the new password handle referencing 45 * the password provided in desiredPassword. 46 * This buffer can be used on subsequent calls to enroll or 47 * verify. On error, this buffer must be empty. 48 * response.code must always contain operation completion status. 49 * This method may return ERROR_GENERAL_FAILURE or ERROR_RETRY_TIMEOUT on 50 * failure. It must return STATUS_OK on success. 51 * If ERROR_RETRY_TIMEOUT is returned, response.timeout must be non-zero. 52 */ 53enroll(uint32_t uid, 54 vec<uint8_t> currentPasswordHandle, 55 vec<uint8_t> currentPassword, 56 vec<uint8_t> desiredPassword) 57 generates (GatekeeperResponse response); 58 59/** 60 * Verifies that providedPassword matches enrolledPasswordHandle. 61 * 62 * Implementations of this module may retain the result of this call 63 * to attest to the recency of authentication. 64 * 65 * On success, returns verification token in response.data, which shall be 66 * usable to attest password verification to other trusted services. 67 * 68 * @param uid The Android user identifier 69 * 70 * @param challenge An optional challenge to authenticate against, or 0. 71 * Used when a separate authenticator requests password verification, 72 * or for transactional password authentication. 73 * 74 * @param enrolledPasswordHandle The currently enrolled password handle that 75 * user wishes to verify against. Must be non-empty. 76 * 77 * @param providedPassword The plaintext password to be verified against the 78 * enrolledPasswordHandle 79 * 80 * @return response 81 * On success, a non-empty data buffer containing the 82 * authentication token resulting from this verification is returned. 83 * On error, data buffer must be empty. 84 * response.code must always contain operation completion status. 85 * This method may return ERROR_GENERAL_FAILURE or ERROR_RETRY_TIMEOUT on 86 * failure. It must return STATUS_OK on success. 87 * If password re-enrollment is necessary, it must return STATUS_REENROLL. 88 * If ERROR_RETRY_TIMEOUT is returned, response.timeout must be non-zero. 89 */ 90verify(uint32_t uid, uint64_t challenge, 91 vec<uint8_t> enrolledPasswordHandle, 92 vec<uint8_t> providedPassword) 93 generates (GatekeeperResponse response); 94 95/** 96 * Deletes the enrolledPasswordHandle associated with the uid. Once deleted 97 * the user cannot be verified anymore. 98 * This is an optional method. 99 * 100 * @param uid The Android user identifier 101 * 102 * @return response 103 * response.code must always contain operation completion status. 104 * This method may return ERROR_GENERAL_FAILURE or ERROR_RETRY_TIMEOUT on 105 * failure. It must return STATUS_OK on success. 106 * If not implemented, it must return ERROR_NOT_IMPLEMENTED. 107 * If ERROR_RETRY_TIMEOUT is returned, response.timeout must be non-zero. 108 */ 109deleteUser(uint32_t uid) generates (GatekeeperResponse response); 110 111/** 112 * Deletes all the enrolled_password_handles for all uid's. Once called, 113 * no users must be enrolled on the device. 114 * This is an optional method. 115 * 116 * @return response 117 * response.code must always contain operation completion status. 118 * This method may return ERROR_GENERAL_FAILURE or ERROR_RETRY_TIMEOUT on 119 * failure. It must return STATUS_OK on success. 120 * If not implemented, it must return ERROR_NOT_IMPLEMENTED. 121 * If ERROR_RETRY_TIMEOUT is returned, response.timeout must be non-zero. 122 */ 123deleteAllUsers() generates (GatekeeperResponse response); 124}; 125