3838import java .security .PrivateKey ;
3939import java .security .PublicKey ;
4040import java .util .Calendar ;
41+ import java .security .UnrecoverableKeyException ;
4142import java .util .HashMap ;
4243import java .util .Map ;
4344import java .util .concurrent .Executor ;
@@ -360,7 +361,7 @@ private void initFingerprintKeyStore() {
360361 prepareKey ();
361362 }
362363 } catch (Exception e ) {
363- e . printStackTrace ();
364+ //
364365 }
365366 }
366367
@@ -401,7 +402,6 @@ private void putExtraWithAES(final String key, final String value, final SharedP
401402 cipher = Cipher .getInstance (AES_DEFAULT_TRANSFORMATION );
402403 cipher .init (Cipher .ENCRYPT_MODE , secretKey );
403404
404-
405405 // Retrieve information about the SecretKey from the KeyStore.
406406 SecretKeyFactory factory = SecretKeyFactory .getInstance (
407407 secretKey .getAlgorithm (), ANDROID_KEYSTORE_PROVIDER );
@@ -468,6 +468,7 @@ public void onAuthenticationSucceeded(FingerprintManager.AuthenticationResult re
468468 }
469469 return ;
470470 }
471+
471472 byte [] encryptedBytes = cipher .doFinal (value .getBytes ());
472473
473474 // Encode the initialization vector (IV) and encryptedBytes to Base64.
@@ -478,7 +479,7 @@ public void onAuthenticationSucceeded(FingerprintManager.AuthenticationResult re
478479
479480 putExtra (key , result , mSharedPreferences );
480481 pm .resolve (value );
481- } catch (InvalidKeyException e ) {
482+ } catch (InvalidKeyException | UnrecoverableKeyException e ) {
482483 try {
483484 mKeyStore .deleteEntry (KEY_ALIAS_AES );
484485 prepareKey ();
@@ -586,7 +587,7 @@ public void onAuthenticationSucceeded(FingerprintManager.AuthenticationResult re
586587 }
587588 byte [] decryptedBytes = cipher .doFinal (cipherBytes );
588589 pm .resolve (new String (decryptedBytes ));
589- } catch (InvalidKeyException e ) {
590+ } catch (InvalidKeyException | UnrecoverableKeyException e ) {
590591 try {
591592 mKeyStore .deleteEntry (KEY_ALIAS_AES );
592593 prepareKey ();
0 commit comments