Surface KeyPermanentlyInvalidatedException for per-op auth keys.

Bug: 20642549
Change-Id: Ibda270921f13a1fd695264583b0e4bd255f63aed
This commit is contained in:
Alex Klyubin
2015-04-29 20:28:41 -07:00
parent 4fbdbbe8f1
commit 459ef1e7ce
2 changed files with 20 additions and 0 deletions

View File

@@ -183,6 +183,16 @@ public abstract class KeyStoreHmacSpi extends MacSpi implements KeyStoreCryptoOp
mChunkedStreamer = new KeyStoreCryptoOperationChunkedStreamer(
new KeyStoreCryptoOperationChunkedStreamer.MainDataStream(
mKeyStore, mOperationToken));
if (opResult.resultCode != KeyStore.NO_ERROR) {
// The operation requires user authentication. Check whether such authentication is
// possible (e.g., the key may have been permanently invalidated).
InvalidKeyException e =
mKeyStore.getInvalidKeyException(mKey.getAlias(), opResult.resultCode);
if (!(e instanceof UserNotAuthenticatedException)) {
throw e;
}
}
}
@Override