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

Commit 8ff1e193 authored by Janis Danisevskis's avatar Janis Danisevskis
Browse files

Add KeyAttestationApplicationIdProviderService to SystemServer

Add getKeyAttestationApplicationId and the Parcelables
KeyAttestationPackageInfo and KeyAttestationApplicationId,
needed by keystore.

Bug: 22914603
Change-Id: I89a88cd9cd80e9b132ca67fc452e9cae8b8ad241
parent da3addda
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -238,6 +238,7 @@ LOCAL_SRC_FILES += \
	core/java/android/os/IUserManager.aidl \
	core/java/android/os/IVibratorService.aidl \
	core/java/android/security/IKeystoreService.aidl \
	core/java/android/security/keymaster/IKeyAttestationApplicationIdProvider.aidl \
	core/java/android/service/carrier/ICarrierService.aidl \
	core/java/android/service/carrier/ICarrierMessagingCallback.aidl \
	core/java/android/service/carrier/ICarrierMessagingService.aidl \
+21 −9
Original line number Diff line number Diff line
@@ -17,4 +17,16 @@

package android.content.pm;

parcelable Signature;
/* For the key attestation application id provider service we needed a native implementation
 * of the Signature parcelable because the service is used by the native keystore.
 * The native implementation is now located at
 * system/security/keystore/Signature.cpp
 * and
 * system/security/keystore/include/keystore/Signature.h.
 * and can be used by linking against libkeystore_binder.
 *
 * This is not the best arrangement. If you, dear reader, happen to implement native implementations
 * for the package manager's parcelables, consider moving Signature.cpp/.h to your library and
 * adjust keystore's dependencies accordingly. Thank you.
 */
parcelable Signature cpp_header "keystore/Signature.h";
+32 −0
Original line number Diff line number Diff line
/**
 * Copyright (c) 2016, 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.keymaster;

import android.security.keymaster.KeyAttestationApplicationId;
import android.security.keymaster.KeyAttestationPackageInfo;
import android.content.pm.Signature;

/**
 * This must be kept manually in sync with system/security/keystore until AIDL
 * can generate both Java and C++ bindings.
 *
 * @hide
 */
interface IKeyAttestationApplicationIdProvider {
    /* keep in sync with /system/security/keystore/keystore_attestation_id.cpp */
    KeyAttestationApplicationId getKeyAttestationApplicationId(int uid);
}
+22 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2016, 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.keymaster;

/* The cpp_header is relative to system/security/keystore/include
 * Link against libkeystore_binder to make use of the native implementation of this Parcelable.
 */
parcelable KeyAttestationApplicationId cpp_header "keystore/KeyAttestationApplicationId.h";
+74 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 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.keymaster;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * @hide
 * The information aggregated by this class is used by keystore to identify a caller of the
 * keystore API toward a remote party. It aggregates multiple PackageInfos because keystore
 * can only determine a caller by uid granularity, and a uid can be shared by multiple packages.
 * The remote party must decide if it trusts all of the packages enough to consider the
 * confidentiality of the key material in question intact.
 */
public class KeyAttestationApplicationId implements Parcelable {
    private final KeyAttestationPackageInfo[] mAttestationPackageInfos;

    /**
     * @param mAttestationPackageInfos
     */
    public KeyAttestationApplicationId(KeyAttestationPackageInfo[] mAttestationPackageInfos) {
        super();
        this.mAttestationPackageInfos = mAttestationPackageInfos;
    }

    /**
     * @return the mAttestationPackageInfos
     */
    public KeyAttestationPackageInfo[] getAttestationPackageInfos() {
        return mAttestationPackageInfos;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeTypedArray(mAttestationPackageInfos, flags);
    }

    public static final Parcelable.Creator<KeyAttestationApplicationId> CREATOR
            = new Parcelable.Creator<KeyAttestationApplicationId>() {
        @Override
        public KeyAttestationApplicationId createFromParcel(Parcel source) {
            return new KeyAttestationApplicationId(source);
        }

        @Override
        public KeyAttestationApplicationId[] newArray(int size) {
            return new KeyAttestationApplicationId[size];
        }
    };

    KeyAttestationApplicationId(Parcel source) {
        mAttestationPackageInfos = source.createTypedArray(KeyAttestationPackageInfo.CREATOR);
    }
}
Loading