1 /* 2 * Copyright (C) 2015 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.security.keystore; 18 19 import java.security.InvalidKeyException; 20 21 /** 22 * Indicates that the key can no longer be used because it has been permanently invalidated. 23 * 24 * <p>This only occurs for keys which are authorized to be used only if the user has been 25 * authenticated. Such keys are permanently and irreversibly invalidated once the secure lock screen 26 * is disabled (i.e., reconfigured to None, Swipe or other mode which does not authenticate the 27 * user) or when the secure lock screen is forcibly reset (e.g., by Device Admin). Additionally, 28 * keys configured to require user authentication to take place for every of the keys, are also 29 * permanently invalidated once a new fingerprint is enrolled or once no more fingerprints are 30 * enrolled. 31 */ 32 public class KeyPermanentlyInvalidatedException extends InvalidKeyException { 33 34 /** 35 * Constructs a new {@code KeyPermanentlyInvalidatedException} without detail message and cause. 36 */ KeyPermanentlyInvalidatedException()37 public KeyPermanentlyInvalidatedException() { 38 super("Key permanently invalidated"); 39 } 40 41 /** 42 * Constructs a new {@code KeyPermanentlyInvalidatedException} with the provided detail message 43 * and no cause. 44 */ KeyPermanentlyInvalidatedException(String message)45 public KeyPermanentlyInvalidatedException(String message) { 46 super(message); 47 } 48 49 /** 50 * Constructs a new {@code KeyPermanentlyInvalidatedException} with the provided detail message 51 * and cause. 52 */ KeyPermanentlyInvalidatedException(String message, Throwable cause)53 public KeyPermanentlyInvalidatedException(String message, Throwable cause) { 54 super(message, cause); 55 } 56 } 57