diff --git a/core/java/com/android/internal/util/ParcelableString.java b/core/java/com/android/internal/util/ParcelableString.java new file mode 100644 index 0000000000000..6bd856f5521de --- /dev/null +++ b/core/java/com/android/internal/util/ParcelableString.java @@ -0,0 +1,52 @@ +/* + * Copyright 2014, 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 com.android.internal.util; + +import android.os.Parcel; +import android.os.Parcelable; + +/** + * Helper class to adapt a simple String to cases where a Parcelable is expected. + * @hide + */ +public class ParcelableString implements Parcelable { + public String string; + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel out, int flags) { + out.writeString(string); + } + + public static final Parcelable.Creator CREATOR = + new Parcelable.Creator() { + @Override + public ParcelableString createFromParcel(Parcel in) { + ParcelableString ret = new ParcelableString(); + ret.string = in.readString(); + return ret; + } + @Override + public ParcelableString[] newArray(int size) { + return new ParcelableString[size]; + } + }; +} \ No newline at end of file diff --git a/keystore/java/android/security/IKeyChainService.aidl b/keystore/java/android/security/IKeyChainService.aidl index 60fd7f79318d6..a93891a42662f 100644 --- a/keystore/java/android/security/IKeyChainService.aidl +++ b/keystore/java/android/security/IKeyChainService.aidl @@ -15,6 +15,8 @@ */ package android.security; +import android.content.pm.ParceledListSlice; + /** * Caller is required to ensure that {@link KeyStore#unlock * KeyStore.unlock} was successful. @@ -32,6 +34,11 @@ interface IKeyChainService { // APIs used by Settings boolean deleteCaCertificate(String alias); boolean reset(); + ParceledListSlice getUserCaAliases(); + ParceledListSlice getSystemCaAliases(); + boolean containsCaAlias(String alias); + byte[] getEncodedCaCertificate(String alias, boolean includeDeletedSystem); + List getCaCertificateChainAliases(String rootAlias, boolean includeDeletedSystem); // APIs used by KeyChainActivity void setGrant(int uid, String alias, boolean value); diff --git a/keystore/java/android/security/KeyChain.java b/keystore/java/android/security/KeyChain.java index 0da2b99894448..131e6893baa9b 100644 --- a/keystore/java/android/security/KeyChain.java +++ b/keystore/java/android/security/KeyChain.java @@ -397,7 +397,8 @@ public final class KeyChain { return KeyStore.getInstance().isHardwareBacked(algorithm); } - private static X509Certificate toCertificate(byte[] bytes) { + /** @hide */ + public static X509Certificate toCertificate(byte[] bytes) { if (bytes == null) { throw new IllegalArgumentException("bytes == null"); }