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

Commit d07d143e 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

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I5b7ccf5be5573f0079f19caa7719bfcc37f440cd
parents 5ff53b17 2ced3500
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);