1 /*
2  * Copyright (C) 2022 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.rkp;
18 
19 import android.security.rkp.IRegistration;
20 import android.security.rkp.IGetRegistrationCallback;
21 
22 /**
23  * {@link IRemoteProvisioning} is the interface provided to use the remote key
24  * provisioning functionality from the Remote Key Provisioning Daemon (RKPD).
25  * This would be the first service that RKPD clients would interact with. The
26  * intent is for the clients to get the {@link IRegistration} object from this
27  * interface and use it for actual remote provisioning work.
28  *
29  * @hide
30  */
31 oneway interface IRemoteProvisioning {
32     /**
33      * Takes a remotely provisioned component service name and gets a
34      * registration bound to that service and the caller's UID.
35      *
36      * @param irpcName The name of the {@code IRemotelyProvisionedComponent}
37      * for which remotely provisioned keys should be managed.
38      * @param callback Receives the result of the call. A callback must only
39      * be used with one {@code getRegistration} call at a time.
40      *
41      * Notes:
42      * - This function will attempt to get the service named by irpcName. This
43      *   implies that a lazy/dynamic aidl service will be instantiated, and this
44      *   function blocks until the service is up. Upon return, any binder tokens
45      *   are dropped, allowing the lazy/dynamic service to shutdown.
46      * - The created registration object is unique per caller. If two different
47      *   UIDs call getRegistration with the same irpcName, they will receive
48      *   different registrations. This prevents two different applications from
49      *   being able to see the same keys.
50      * - This function is idempotent per calling UID. Additional calls to
51      *   getRegistration with the same parameters, from the same caller, will have
52      *   no side effects.
53      * - A callback may only be associated with one getRegistration call at a time.
54      *   If the callback is used multiple times, this API will return an error.
55      *
56      * @see IRegistration#getKey()
57      * @see IRemotelyProvisionedComponent
58      *
59      */
getRegistration(String irpcName, IGetRegistrationCallback callback)60     void getRegistration(String irpcName, IGetRegistrationCallback callback);
61 }
62