Skip to content

Commit ddd0e87

Browse files
author
Sybil Ehrensberger
committed
Handle KeyStoreException in Android 8.0
Implementation is based on sjhoeksma#31
1 parent ba99b74 commit ddd0e87

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/android/FingerprintAuthAux.java

+14-2
Original file line numberDiff line numberDiff line change
@@ -547,9 +547,21 @@ public void onAuthenticated(boolean withFingerprint) {
547547
+ e.getMessage();
548548
Log.e(TAG, errorMessage);
549549
} catch (IllegalBlockSizeException e) {
550+
String message = e.getMessage();
551+
String exception = e.getClass().getSimpleName();
552+
if (message == null) {
553+
Throwable cause = e.getCause();
554+
if (cause != null) {
555+
message = cause.getMessage();
556+
exception = cause.getClass().getSimpleName();
557+
}
558+
}
550559
errorMessage = "Failed to encrypt the data with the generated key: "
551-
+ "IllegalBlockSizeException: "
552-
+ e.getMessage();
560+
+ exception + ": " + message;
561+
if (message.equals("Key user not authenticated")) {
562+
removePermanentlyInvalidatedKey();
563+
errorMessage = "KeyPermanentlyInvalidatedException";
564+
}
553565
Log.e(TAG, errorMessage);
554566
}
555567

0 commit comments

Comments
 (0)