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

Commit 7a2c973d authored by Chad Brubaker's avatar Chad Brubaker
Browse files

Generate IKeystoreService using aidl

This replaces IKeystoreService.java with IKeystoreService.aidl and
changes the methods that passed down a byte[][] to instead pass down a
KeystoreArguments which is currently a thin parcelable wrapper around a byte[][].

Change-Id: I6367bcf57562f41a27aab14f1903b74995cb65c2
parent 21454aa2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -202,6 +202,7 @@ LOCAL_SRC_FILES += \
	core/java/android/os/IUpdateLock.aidl \
	core/java/android/os/IUserManager.aidl \
	core/java/android/os/IVibratorService.aidl \
	core/java/android/security/IKeystoreService.aidl \
	core/java/android/service/notification/INotificationListener.aidl \
	core/java/android/service/notification/IStatusBarNotificationHolder.aidl \
	core/java/android/service/notification/IConditionListener.aidl \
+55 −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.security.KeystoreArguments;

/**
 * This must be kept manually in sync with system/security/keystore until AIDL
 * can generate both Java and C++ bindings.
 *
 * @hide
 */
interface IKeystoreService {
    int test();
    byte[] get(String name);
    int insert(String name, in byte[] item, int uid, int flags);
    int del(String name, int uid);
    int exist(String name, int uid);
    String[] saw(String namePrefix, int uid);
    int reset();
    int password(String password);
    int lock();
    int unlock(String password);
    int zero();
    int generate(String name, int uid, int keyType, int keySize, int flags,
        in KeystoreArguments args);
    int import_key(String name, in byte[] data, int uid, int flags);
    byte[] sign(String name, in byte[] data);
    int verify(String name, in byte[] data, in byte[] signature);
    byte[] get_pubkey(String name);
    int del_key(String name, int uid);
    int grant(String name, int granteeUid);
    int ungrant(String name, int granteeUid);
    long getmtime(String name);
    int duplicate(String srcKey, int srcUid, String destKey, int destUid);
    int is_hardware_backed(String string);
    int clear_uid(long uid);
    int reset_uid(int uid);
    int sync_uid(int sourceUid, int targetUid);
    int password_uid(String password, int uid);
}
+0 −662

File deleted.

Preview size limit exceeded, changes collapsed.

+20 −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;

/* @hide */
parcelable KeystoreArguments;
+76 −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.Parcel;
import android.os.Parcelable;

/**
 * Class for handling the additional arguments to some keystore binder calls.
 * This must be kept in sync with the deserialization code in system/security/keystore.
 * @hide
 */
public class KeystoreArguments implements Parcelable {
    public byte[][] args;

    public static final Parcelable.Creator<KeystoreArguments> CREATOR = new
            Parcelable.Creator<KeystoreArguments>() {
                public KeystoreArguments createFromParcel(Parcel in) {
                    return new KeystoreArguments(in);
                }
                public KeystoreArguments[] newArray(int size) {
                    return new KeystoreArguments[size];
                }
            };

    public KeystoreArguments() {
        args = null;
    }

    public KeystoreArguments(byte[][] args) {
        this.args = args;
    }

    private KeystoreArguments(Parcel in) {
        readFromParcel(in);
    }

    @Override
    public void writeToParcel(Parcel out, int flags) {
        if (args == null) {
            out.writeInt(0);
        } else {
            out.writeInt(args.length);
            for (byte[] arg : args) {
                out.writeByteArray(arg);
            }
        }
    }

    private void readFromParcel(Parcel in) {
        int length = in.readInt();
        args = new byte[length][];
        for (int i = 0; i < length; i++) {
            args[i] = in.createByteArray();
        }
    }

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