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

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
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -352,11 +352,14 @@ public class AndroidKeyStoreProvider extends Provider {
        try {
            response = keyStore.getKeyEntry(descriptor);
        } catch (android.security.KeyStoreException e) {
            if (e.getErrorCode() == ResponseCode.KEY_PERMANENTLY_INVALIDATED) {
            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);
            } else {
                default:
                    throw (UnrecoverableKeyException)
                            new UnrecoverableKeyException("Failed to obtain information about key")
                                    .initCause(e);