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

Commit 9e1bd362 authored by Robert Berry's avatar Robert Berry
Browse files

Rename KeychainProtectionParameter to KeychainProtectionParams

Test: adb shell am instrument -w -e package
com.android.server.locksettings.recoverablekeystore
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: Iab6d85d0be38e1a09ce78bb96b8f68493de65be9
parent 1fc49dc6
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -17,4 +17,4 @@
package android.security.keystore;
package android.security.keystore;


/* @hide */
/* @hide */
parcelable KeychainProtectionParameter;
parcelable KeychainProtectionParams;
+14 −14
Original line number Original line Diff line number Diff line
@@ -47,7 +47,7 @@ import java.util.Arrays;
 *
 *
 * @hide
 * @hide
 */
 */
public final class KeychainProtectionParameter implements Parcelable {
public final class KeychainProtectionParams implements Parcelable {
    /** @hide */
    /** @hide */
    @Retention(RetentionPolicy.SOURCE)
    @Retention(RetentionPolicy.SOURCE)
    @IntDef({TYPE_LOCKSCREEN, TYPE_CUSTOM_PASSWORD})
    @IntDef({TYPE_LOCKSCREEN, TYPE_CUSTOM_PASSWORD})
@@ -102,7 +102,7 @@ public final class KeychainProtectionParameter implements Parcelable {
     * @link {#clearSecret} to overwrite its value in memory.
     * @link {#clearSecret} to overwrite its value in memory.
     * @hide
     * @hide
     */
     */
    public KeychainProtectionParameter(@UserSecretType int userSecretType,
    public KeychainProtectionParams(@UserSecretType int userSecretType,
            @LockScreenUiFormat int lockScreenUiFormat,
            @LockScreenUiFormat int lockScreenUiFormat,
            @NonNull KeyDerivationParams keyDerivationParams,
            @NonNull KeyDerivationParams keyDerivationParams,
            @NonNull byte[] secret) {
            @NonNull byte[] secret) {
@@ -112,7 +112,7 @@ public final class KeychainProtectionParameter implements Parcelable {
        mSecret = Preconditions.checkNotNull(secret);
        mSecret = Preconditions.checkNotNull(secret);
    }
    }


    private KeychainProtectionParameter() {
    private KeychainProtectionParams() {


    }
    }


@@ -155,10 +155,10 @@ public final class KeychainProtectionParameter implements Parcelable {
    }
    }


    /**
    /**
     * Builder for creating {@link KeychainProtectionParameter}.
     * Builder for creating {@link KeychainProtectionParams}.
     */
     */
    public static class Builder {
    public static class Builder {
        private KeychainProtectionParameter mInstance = new KeychainProtectionParameter();
        private KeychainProtectionParams mInstance = new KeychainProtectionParams();


        /**
        /**
         * Sets user secret type.
         * Sets user secret type.
@@ -212,14 +212,14 @@ public final class KeychainProtectionParameter implements Parcelable {




        /**
        /**
         * Creates a new {@link KeychainProtectionParameter} instance.
         * Creates a new {@link KeychainProtectionParams} instance.
         * The instance will include default values, if {@link setSecret}
         * The instance will include default values, if {@link setSecret}
         * or {@link setUserSecretType} were not called.
         * or {@link setUserSecretType} were not called.
         *
         *
         * @return new instance
         * @return new instance
         * @throws NullPointerException if some required fields were not set.
         * @throws NullPointerException if some required fields were not set.
         */
         */
        @NonNull public KeychainProtectionParameter build() {
        @NonNull public KeychainProtectionParams build() {
            if (mInstance.mUserSecretType == null) {
            if (mInstance.mUserSecretType == null) {
                mInstance.mUserSecretType = TYPE_LOCKSCREEN;
                mInstance.mUserSecretType = TYPE_LOCKSCREEN;
            }
            }
@@ -249,14 +249,14 @@ public final class KeychainProtectionParameter implements Parcelable {
        Arrays.fill(mSecret, (byte) 0);
        Arrays.fill(mSecret, (byte) 0);
    }
    }


    public static final Parcelable.Creator<KeychainProtectionParameter> CREATOR =
    public static final Parcelable.Creator<KeychainProtectionParams> CREATOR =
            new Parcelable.Creator<KeychainProtectionParameter>() {
            new Parcelable.Creator<KeychainProtectionParams>() {
        public KeychainProtectionParameter createFromParcel(Parcel in) {
        public KeychainProtectionParams createFromParcel(Parcel in) {
            return new KeychainProtectionParameter(in);
            return new KeychainProtectionParams(in);
        }
        }


        public KeychainProtectionParameter[] newArray(int length) {
        public KeychainProtectionParams[] newArray(int length) {
            return new KeychainProtectionParameter[length];
            return new KeychainProtectionParams[length];
        }
        }
    };
    };


@@ -274,7 +274,7 @@ public final class KeychainProtectionParameter implements Parcelable {
    /**
    /**
     * @hide
     * @hide
     */
     */
    protected KeychainProtectionParameter(Parcel in) {
    protected KeychainProtectionParams(Parcel in) {
        mUserSecretType = in.readInt();
        mUserSecretType = in.readInt();
        mLockScreenUiFormat = in.readInt();
        mLockScreenUiFormat = in.readInt();
        mKeyDerivationParams = in.readTypedObject(KeyDerivationParams.CREATOR);
        mKeyDerivationParams = in.readTypedObject(KeyDerivationParams.CREATOR);
+5 −5
Original line number Original line Diff line number Diff line
@@ -44,7 +44,7 @@ import java.util.List;
 */
 */
public final class KeychainSnapshot implements Parcelable {
public final class KeychainSnapshot implements Parcelable {
    private int mSnapshotVersion;
    private int mSnapshotVersion;
    private List<KeychainProtectionParameter> mKeychainProtectionParams;
    private List<KeychainProtectionParams> mKeychainProtectionParams;
    private List<WrappedApplicationKey> mEntryRecoveryData;
    private List<WrappedApplicationKey> mEntryRecoveryData;
    private byte[] mEncryptedRecoveryKeyBlob;
    private byte[] mEncryptedRecoveryKeyBlob;


@@ -54,7 +54,7 @@ public final class KeychainSnapshot implements Parcelable {
     */
     */
    public KeychainSnapshot(
    public KeychainSnapshot(
            int snapshotVersion,
            int snapshotVersion,
            @NonNull List<KeychainProtectionParameter> keychainProtectionParams,
            @NonNull List<KeychainProtectionParams> keychainProtectionParams,
            @NonNull List<WrappedApplicationKey> wrappedApplicationKeys,
            @NonNull List<WrappedApplicationKey> wrappedApplicationKeys,
            @NonNull byte[] encryptedRecoveryKeyBlob) {
            @NonNull byte[] encryptedRecoveryKeyBlob) {
        mSnapshotVersion = snapshotVersion;
        mSnapshotVersion = snapshotVersion;
@@ -81,7 +81,7 @@ public final class KeychainSnapshot implements Parcelable {
    /**
    /**
     * UI and key derivation parameters. Note that combination of secrets may be used.
     * UI and key derivation parameters. Note that combination of secrets may be used.
     */
     */
    public @NonNull List<KeychainProtectionParameter> getKeychainProtectionParams() {
    public @NonNull List<KeychainProtectionParams> getKeychainProtectionParams() {
        return mKeychainProtectionParams;
        return mKeychainProtectionParams;
    }
    }


@@ -135,7 +135,7 @@ public final class KeychainSnapshot implements Parcelable {
         * @return This builder.
         * @return This builder.
         */
         */
        public Builder setKeychainProtectionParams(
        public Builder setKeychainProtectionParams(
                @NonNull List<KeychainProtectionParameter> recoveryMetadata) {
                @NonNull List<KeychainProtectionParams> recoveryMetadata) {
            mInstance.mKeychainProtectionParams = recoveryMetadata;
            mInstance.mKeychainProtectionParams = recoveryMetadata;
            return this;
            return this;
        }
        }
@@ -195,7 +195,7 @@ public final class KeychainSnapshot implements Parcelable {
     */
     */
    protected KeychainSnapshot(Parcel in) {
    protected KeychainSnapshot(Parcel in) {
        mSnapshotVersion = in.readInt();
        mSnapshotVersion = in.readInt();
        mKeychainProtectionParams = in.createTypedArrayList(KeychainProtectionParameter.CREATOR);
        mKeychainProtectionParams = in.createTypedArrayList(KeychainProtectionParams.CREATOR);
        mEncryptedRecoveryKeyBlob = in.createByteArray();
        mEncryptedRecoveryKeyBlob = in.createByteArray();
        mEntryRecoveryData = in.createTypedArrayList(WrappedApplicationKey.CREATOR);
        mEntryRecoveryData = in.createTypedArrayList(WrappedApplicationKey.CREATOR);
    }
    }
+8 −8
Original line number Original line Diff line number Diff line
@@ -286,13 +286,13 @@ public class RecoveryManager {
     * Specifies a set of secret types used for end-to-end keystore encryption. Knowing all of them
     * Specifies a set of secret types used for end-to-end keystore encryption. Knowing all of them
     * is necessary to recover data.
     * is necessary to recover data.
     *
     *
     * @param secretTypes {@link KeychainProtectionParameter#TYPE_LOCKSCREEN} or {@link
     * @param secretTypes {@link KeychainProtectionParams#TYPE_LOCKSCREEN} or {@link
     *     KeychainProtectionParameter#TYPE_CUSTOM_PASSWORD}
     *     KeychainProtectionParams#TYPE_CUSTOM_PASSWORD}
     * @throws InternalRecoveryServiceException if an unexpected error occurred in the recovery
     * @throws InternalRecoveryServiceException if an unexpected error occurred in the recovery
     *     service.
     *     service.
     */
     */
    public void setRecoverySecretTypes(
    public void setRecoverySecretTypes(
            @NonNull @KeychainProtectionParameter.UserSecretType int[] secretTypes)
            @NonNull @KeychainProtectionParams.UserSecretType int[] secretTypes)
            throws InternalRecoveryServiceException {
            throws InternalRecoveryServiceException {
        try {
        try {
            mBinder.setRecoverySecretTypes(secretTypes);
            mBinder.setRecoverySecretTypes(secretTypes);
@@ -312,7 +312,7 @@ public class RecoveryManager {
     * @throws InternalRecoveryServiceException if an unexpected error occurred in the recovery
     * @throws InternalRecoveryServiceException if an unexpected error occurred in the recovery
     *     service.
     *     service.
     */
     */
    public @NonNull @KeychainProtectionParameter.UserSecretType int[] getRecoverySecretTypes()
    public @NonNull @KeychainProtectionParams.UserSecretType int[] getRecoverySecretTypes()
            throws InternalRecoveryServiceException {
            throws InternalRecoveryServiceException {
        try {
        try {
            return mBinder.getRecoverySecretTypes();
            return mBinder.getRecoverySecretTypes();
@@ -333,7 +333,7 @@ public class RecoveryManager {
     *     service.
     *     service.
     */
     */
    @NonNull
    @NonNull
    public @KeychainProtectionParameter.UserSecretType int[] getPendingRecoverySecretTypes()
    public @KeychainProtectionParams.UserSecretType int[] getPendingRecoverySecretTypes()
            throws InternalRecoveryServiceException {
            throws InternalRecoveryServiceException {
        try {
        try {
            return mBinder.getPendingRecoverySecretTypes();
            return mBinder.getPendingRecoverySecretTypes();
@@ -347,7 +347,7 @@ public class RecoveryManager {
    /**
    /**
     * Method notifies KeyStore that a user-generated secret is available. This method generates a
     * Method notifies KeyStore that a user-generated secret is available. This method generates a
     * symmetric session key which a trusted remote device can use to return a recovery key. Caller
     * symmetric session key which a trusted remote device can use to return a recovery key. Caller
     * should use {@link KeychainProtectionParameter#clearSecret} to override the secret value in
     * should use {@link KeychainProtectionParams#clearSecret} to override the secret value in
     * memory.
     * memory.
     *
     *
     * @param recoverySecret user generated secret together with parameters necessary to regenerate
     * @param recoverySecret user generated secret together with parameters necessary to regenerate
@@ -355,7 +355,7 @@ public class RecoveryManager {
     * @throws InternalRecoveryServiceException if an unexpected error occurred in the recovery
     * @throws InternalRecoveryServiceException if an unexpected error occurred in the recovery
     *     service.
     *     service.
     */
     */
    public void recoverySecretAvailable(@NonNull KeychainProtectionParameter recoverySecret)
    public void recoverySecretAvailable(@NonNull KeychainProtectionParams recoverySecret)
            throws InternalRecoveryServiceException {
            throws InternalRecoveryServiceException {
        try {
        try {
            mBinder.recoverySecretAvailable(recoverySecret);
            mBinder.recoverySecretAvailable(recoverySecret);
@@ -393,7 +393,7 @@ public class RecoveryManager {
            @NonNull byte[] verifierPublicKey,
            @NonNull byte[] verifierPublicKey,
            @NonNull byte[] vaultParams,
            @NonNull byte[] vaultParams,
            @NonNull byte[] vaultChallenge,
            @NonNull byte[] vaultChallenge,
            @NonNull List<KeychainProtectionParameter> secrets)
            @NonNull List<KeychainProtectionParams> secrets)
            throws BadCertificateFormatException, InternalRecoveryServiceException {
            throws BadCertificateFormatException, InternalRecoveryServiceException {
        try {
        try {
            byte[] recoveryClaim =
            byte[] recoveryClaim =
+3 −3
Original line number Original line Diff line number Diff line
@@ -21,7 +21,7 @@ import android.app.trust.IStrongAuthTracker;
import android.os.Bundle;
import android.os.Bundle;
import android.security.keystore.WrappedApplicationKey;
import android.security.keystore.WrappedApplicationKey;
import android.security.keystore.KeychainSnapshot;
import android.security.keystore.KeychainSnapshot;
import android.security.keystore.KeychainProtectionParameter;
import android.security.keystore.KeychainProtectionParams;
import com.android.internal.widget.ICheckCredentialProgressCallback;
import com.android.internal.widget.ICheckCredentialProgressCallback;
import com.android.internal.widget.VerifyCredentialResponse;
import com.android.internal.widget.VerifyCredentialResponse;


@@ -75,10 +75,10 @@ interface ILockSettings {
    void setRecoverySecretTypes(in int[] secretTypes);
    void setRecoverySecretTypes(in int[] secretTypes);
    int[] getRecoverySecretTypes();
    int[] getRecoverySecretTypes();
    int[] getPendingRecoverySecretTypes();
    int[] getPendingRecoverySecretTypes();
    void recoverySecretAvailable(in KeychainProtectionParameter recoverySecret);
    void recoverySecretAvailable(in KeychainProtectionParams recoverySecret);
    byte[] startRecoverySession(in String sessionId,
    byte[] startRecoverySession(in String sessionId,
            in byte[] verifierPublicKey, in byte[] vaultParams, in byte[] vaultChallenge,
            in byte[] verifierPublicKey, in byte[] vaultParams, in byte[] vaultChallenge,
            in List<KeychainProtectionParameter> secrets);
            in List<KeychainProtectionParams> secrets);
    Map/*<String, byte[]>*/ recoverKeys(in String sessionId, in byte[] recoveryKeyBlob,
    Map/*<String, byte[]>*/ recoverKeys(in String sessionId, in byte[] recoveryKeyBlob,
            in List<WrappedApplicationKey> applicationKeys);
            in List<WrappedApplicationKey> applicationKeys);
}
}
Loading