Merge "Add remove method to RecoverableKeyStoreLoader."

This commit is contained in:
TreeHugger Robot
2018-01-11 00:53:31 +00:00
committed by Android (Google) Code Review

View File

@@ -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);
}
}
}