Skip to content
Snippets Groups Projects
Commit 2ced3500 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Keystore 2.0: Fix getKey returns null on key not found."

parents f76916a1 b6a9ed2f
No related merge requests found
......@@ -352,14 +352,17 @@ public class AndroidKeyStoreProvider extends Provider {
try {
response = keyStore.getKeyEntry(descriptor);
} catch (android.security.KeyStoreException e) {
if (e.getErrorCode() == ResponseCode.KEY_PERMANENTLY_INVALIDATED) {
throw new KeyPermanentlyInvalidatedException(
"User changed or deleted their auth credentials",
e);
} else {
throw (UnrecoverableKeyException)
new UnrecoverableKeyException("Failed to obtain information about key")
.initCause(e);
switch (e.getErrorCode()) {
case ResponseCode.KEY_NOT_FOUND:
return null;
case ResponseCode.KEY_PERMANENTLY_INVALIDATED:
throw new KeyPermanentlyInvalidatedException(
"User changed or deleted their auth credentials",
e);
default:
throw (UnrecoverableKeyException)
new UnrecoverableKeyException("Failed to obtain information about key")
.initCause(e);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment