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

Commit 567936c9 authored by Alex Klyubin's avatar Alex Klyubin Committed by Android Git Automerger
Browse files

am a1fb2cf6: Merge "Move Android Keystore impl to android.security.keystore." into mnc-dev

* commit 'a1fb2cf6':
  Move Android Keystore impl to android.security.keystore.
parents edc7560a a1fb2cf6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ import android.view.Window;
import android.view.WindowManager;
import android.view.WindowManagerGlobal;
import android.renderscript.RenderScriptCacheDir;
import android.security.AndroidKeyStoreProvider;
import android.security.keystore.AndroidKeyStoreProvider;

import com.android.internal.app.IVoiceInteractor;
import com.android.internal.content.ReferrerIntent;
+1 −1
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ import android.os.RemoteException;
import android.os.UserHandle;
import android.provider.Settings;
import android.hardware.fingerprint.FingerprintManager.EnrollmentCallback;
import android.security.AndroidKeyStoreProvider;
import android.security.keystore.AndroidKeyStoreProvider;
import android.util.Log;
import android.util.Slog;

+3 −3
Original line number Diff line number Diff line
@@ -216,7 +216,7 @@ public class Credentials {
     * particular {@code alias}. All three can exist for any given alias.
     * Returns {@code true} if there was at least one of those types.
     */
    static boolean deleteAllTypesForAlias(KeyStore keystore, String alias) {
    public static boolean deleteAllTypesForAlias(KeyStore keystore, String alias) {
        /*
         * Make sure every type is deleted. There can be all three types, so
         * don't use a conditional here.
@@ -231,7 +231,7 @@ public class Credentials {
     * particular {@code alias}. All three can exist for any given alias.
     * Returns {@code true} if there was at least one of those types.
     */
    static boolean deleteCertificateTypesForAlias(KeyStore keystore, String alias) {
    public static boolean deleteCertificateTypesForAlias(KeyStore keystore, String alias) {
        /*
         * Make sure every certificate type is deleted. There can be two types,
         * so don't use a conditional here.
@@ -252,7 +252,7 @@ public class Credentials {
     * Delete secret key for a particular {@code alias}.
     * Returns {@code true} if an entry was was deleted.
     */
    static boolean deleteSecretKeyTypeForAlias(KeyStore keystore, String alias) {
    public static boolean deleteSecretKeyTypeForAlias(KeyStore keystore, String alias) {
        return keystore.delete(Credentials.USER_SECRET_KEY + alias);
    }
}
+16 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2015 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.security;

import android.os.RemoteException;
+6 −5
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ public class KeyStore {
        mContext = getApplicationContext();
    }

    static Context getApplicationContext() {
    public static Context getApplicationContext() {
        ActivityThread activityThread = ActivityThread.currentActivityThread();
        if (activityThread == null) {
            throw new IllegalStateException(
@@ -136,7 +136,7 @@ public class KeyStore {
        return mToken;
    }

    static int getKeyTypeForAlgorithm(@KeyProperties.KeyAlgorithmEnum String keyType) {
    public static int getKeyTypeForAlgorithm(@KeyProperties.KeyAlgorithmEnum String keyType) {
        if (KeyProperties.KEY_ALGORITHM_RSA.equalsIgnoreCase(keyType)) {
            return NativeConstants.EVP_PKEY_RSA;
        } else if (KeyProperties.KEY_ALGORITHM_EC.equalsIgnoreCase(keyType)) {
@@ -632,7 +632,7 @@ public class KeyStore {
     * Returns a {@link KeyStoreException} corresponding to the provided keystore/keymaster error
     * code.
     */
    static KeyStoreException getKeyStoreException(int errorCode) {
    public static KeyStoreException getKeyStoreException(int errorCode) {
        if (errorCode > 0) {
            // KeyStore layer error
            switch (errorCode) {
@@ -674,7 +674,8 @@ public class KeyStore {
     * Returns an {@link InvalidKeyException} corresponding to the provided
     * {@link KeyStoreException}.
     */
    InvalidKeyException getInvalidKeyException(String keystoreKeyAlias, KeyStoreException e) {
    public InvalidKeyException getInvalidKeyException(
            String keystoreKeyAlias, KeyStoreException e) {
        switch (e.getErrorCode()) {
            case LOCKED:
                return new UserNotAuthenticatedException();
@@ -745,7 +746,7 @@ public class KeyStore {
     * Returns an {@link InvalidKeyException} corresponding to the provided keystore/keymaster error
     * code.
     */
    InvalidKeyException getInvalidKeyException(String keystoreKeyAlias, int errorCode) {
    public InvalidKeyException getInvalidKeyException(String keystoreKeyAlias, int errorCode) {
        return getInvalidKeyException(keystoreKeyAlias, getKeyStoreException(errorCode));
    }
}
Loading