Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 12ac7f0e authored by Alex Johnston's avatar Alex Johnston Committed by Automerger Merge Worker
Browse files

Merge "hasKeyPair callable by the cred mng app" into sc-dev am: 255b41f1

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13918870

Change-Id: I1292c9d141e3cdf0bbe7d62f9b5cb94e7e33c92e
parents d59b6d93 255b41f1
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -6169,13 +6169,22 @@ public class DevicePolicyManager {
    // STOPSHIP(b/174298501): clarify the expected return value following generateKeyPair call.
    /**
     * Called by a device or profile owner, or delegated certificate installer, to query whether a
     * certificate and private key are installed under a given alias.
     * This API can be called by the following to query whether a certificate and private key are
     * installed under a given alias:
     * <ul>
     *    <li>Device owner</li>
     *    <li>Profile owner</li>
     *    <li>Delegated certificate installer</li>
     *    <li>Credential management app</li>
     * </ul>
     *
     * If called by the credential management app, the alias must exist in the credential
     * management app's {@link android.security.AppUriAuthenticationPolicy}.
     *
     * @param alias The alias under which the key pair is installed.
     * @return {@code true} if a key pair with this alias exists, {@code false} otherwise.
     * @throws SecurityException if the caller is not a device or profile owner or a delegated
     *         certificate installer.
     * @throws SecurityException if the caller is not a device or profile owner, a delegated
     *         certificate installer or the credential management app.
     * @see #setDelegatedScopes
     * @see #DELEGATION_CERT_INSTALL
     */
+2 −1
Original line number Diff line number Diff line
@@ -5492,7 +5492,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    @Override
    public boolean hasKeyPair(String callerPackage, String alias) {
        final CallerIdentity caller = getCallerIdentity(callerPackage);
        Preconditions.checkCallAuthorization(canManageCertificates(caller));
        Preconditions.checkCallAuthorization(canManageCertificates(caller)
                || isCredentialManagementApp(caller, alias));
        return mInjector.binderWithCleanCallingIdentity(() -> {
            try (KeyChainConnection keyChainConnection =