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

Commit e77a24b8 authored by Dmitry Dementyev's avatar Dmitry Dementyev
Browse files

Add remove method to RecoverableKeyStoreLoader.

Bug: 66499222
Test: GTS tests will be added.
Change-Id: If352d75fbabe33e3453baed806f569931dbd8ad7
parent f7778083
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -478,10 +478,12 @@ public class RecoverableKeyStoreLoader {
     * Generates a key called {@code alias} and loads it into the recoverable key store. Returns the
     * raw material of the key.
     *
     * @param alias The key alias.
     * @throws RecoverableKeyStoreLoaderException if an error occurred generating and storing the
     *     key.
     */
    public byte[] generateAndStoreKey(String alias) throws RecoverableKeyStoreLoaderException {
    public byte[] generateAndStoreKey(@NonNull String alias)
            throws RecoverableKeyStoreLoaderException {
        try {
            return mBinder.generateAndStoreKey(alias);
        } catch (RemoteException e) {
@@ -490,4 +492,19 @@ public class RecoverableKeyStoreLoader {
            throw RecoverableKeyStoreLoaderException.fromServiceSpecificException(e);
        }
    }

    /**
     * Removes a key called {@code alias} from the recoverable key store.
     *
     * @param alias The key alias.
     */
    public void removeKey(@NonNull String alias) throws RecoverableKeyStoreLoaderException {
        try {
            mBinder.removeKey(alias);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        } catch (ServiceSpecificException e) {
            throw RecoverableKeyStoreLoaderException.fromServiceSpecificException(e);
        }
    }
}