1 /*
2  * Copyright (C) 2020 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.appsecurity.cts.keyrotationtest.service;
18 
19 /**
20  * AIDL service definition intended to test PackageManager key rotation APIs.
21  */
22 interface ISignatureQueryService {
23     const int RESULT_SUCCESS = 0;
24     const int RESULT_PACKAGE_NOT_FOUND = 1;
25     const int RESULT_GET_SIGNATURES_NO_RESULTS = 2;
26     const int RESULT_GET_SIGNATURES_MULTIPLE_SIGNATURES = 3;
27     const int RESULT_GET_SIGNATURES_MISMATCH = 4;
28     const int RESULT_GET_SIGNING_CERTIFICATES_NO_RESULTS = 5;
29     const int RESULT_GET_SIGNING_CERTIFICATES_MULTIPLE_SIGNERS = 6;
30     const int RESULT_GET_SIGNING_CERTIFICATES_UNEXPECTED_NUMBER_OF_SIGNATURES = 7;
31     const int RESULT_GET_SIGNING_CERTIFICATES_UNEXPECTED_SIGNATURE = 8;
32     const int RESULT_HAS_SIGNING_CERTIFICATE_BY_NAME_FAILED = 9;
33     const int RESULT_HAS_SIGNING_CERTIFICATE_BY_UID_FAILED = 10;
34     const int RESULT_NO_EXPECTED_SIGNATURES_PROVIDED = 11;
35     const int RESULT_SHA256_MESSAGE_DIGEST_NOT_AVAILABLE = 12;
36     const int RESULT_COMPANION_PACKAGE_NOT_FOUND = 13;
37     const int RESULT_CHECK_SIGNATURES_BY_NAME_NO_MATCH = 14;
38     const int RESULT_CHECK_SIGNATURES_BY_UID_NO_MATCH = 15;
39 
40     const String KEY_GET_SIGNATURES_RESULTS = "GET_SIGNATURES_RESULTS";
41     const String KEY_GET_SIGNING_CERTIFICATES_RESULTS = "GET_SIGNING_CERTIFICATES_RESULTS";
42     const String KEY_VERIFY_SIGNATURES_RESULT = "VERIFY_SIGNATURES_RESULT";
43 
44     /**
45      * Queries PackageManager key rotation APIs and verifies the results against
46      * the provided {@code expectedSignatureDigests}; the signature(s) of the
47      * specified {@code companionPackageName} are also compared against the app
48      * within which this service is running.
49      */
verifySignatures(in String[] expectedSignatureDigests, in String companionPackageName)50     Bundle verifySignatures(in String[] expectedSignatureDigests, in String companionPackageName);
51 }
52 
53