1 /* 2 * Copyright (C) 2011 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 package com.android.keychain.tests.support; 17 18 import android.accounts.Account; 19 import android.security.keystore.ParcelableKeyGenParameterSpec; 20 21 /** 22 * Service that runs as the system user for the use of the 23 * KeyChainServiceTest which needs to run as a regular app user, but 24 * needs to automate some steps only permissable to the system 25 * user. In particular, revokeAppPermission and grantAppPermission 26 * must be run within the system_server itself. In a real application, 27 * the user is prompted to perform these steps via the 28 * com.android.credentials.UNLOCK Intent and 29 * KeyChainActivity. 30 * 31 * @hide 32 */ 33 interface IKeyChainServiceTestSupport { revokeAppPermission(int uid, String alias)34 void revokeAppPermission(int uid, String alias); grantAppPermission(int uid, String alias)35 void grantAppPermission(int uid, String alias); installKeyPair(in byte[] privateKey, in byte[] userCert, in byte[] certChain, String alias)36 boolean installKeyPair(in byte[] privateKey, in byte[] userCert, in byte[] certChain, String alias); removeKeyPair(String alias)37 boolean removeKeyPair(String alias); setUserSelectable(String alias, boolean isUserSelectable)38 void setUserSelectable(String alias, boolean isUserSelectable); generateKeyPair(in String algorithm, in ParcelableKeyGenParameterSpec spec)39 int generateKeyPair(in String algorithm, in ParcelableKeyGenParameterSpec spec); setKeyPairCertificate(String alias, in byte[] userCert, in byte[] certChain)40 boolean setKeyPairCertificate(String alias, in byte[] userCert, in byte[] certChain); 41 } 42