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

Commit 63b142bf authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Keystore 2.0: Fix getKey returns null on key not found." am: 2ced3500 am: d07d143e

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1578023

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib908588b11a32b37871ac7e6f7af2e88fc7e887e
parents 5362c1b0 d07d143e
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);