3131import com .facebook .react .modules .core .DeviceEventManagerModule ;
3232
3333import java .security .KeyStore ;
34+ import java .security .UnrecoverableKeyException ;
3435import java .util .HashMap ;
3536import java .util .Map ;
3637import java .util .concurrent .Executor ;
@@ -295,6 +296,7 @@ private void initKeyStore() {
295296 prepareKey ();
296297 }
297298 } catch (Exception e ) {
299+ //
298300 }
299301 }
300302
@@ -337,7 +339,6 @@ private void putExtraWithAES(final String key, final String value, final SharedP
337339 cipher = Cipher .getInstance (AES_DEFAULT_TRANSFORMATION );
338340 cipher .init (Cipher .ENCRYPT_MODE , secretKey );
339341
340-
341342 // Retrieve information about the SecretKey from the KeyStore.
342343 SecretKeyFactory factory = SecretKeyFactory .getInstance (
343344 secretKey .getAlgorithm (), ANDROID_KEYSTORE_PROVIDER );
@@ -404,6 +405,7 @@ public void onAuthenticationSucceeded(FingerprintManager.AuthenticationResult re
404405 }
405406 return ;
406407 }
408+
407409 byte [] encryptedBytes = cipher .doFinal (value .getBytes ());
408410
409411 // Encode the initialization vector (IV) and encryptedBytes to Base64.
@@ -414,7 +416,7 @@ public void onAuthenticationSucceeded(FingerprintManager.AuthenticationResult re
414416
415417 putExtra (key , result , mSharedPreferences );
416418 pm .resolve (value );
417- } catch (InvalidKeyException e ) {
419+ } catch (InvalidKeyException | UnrecoverableKeyException e ) {
418420 try {
419421 mKeyStore .deleteEntry (KEY_ALIAS_AES );
420422 prepareKey ();
@@ -522,7 +524,7 @@ public void onAuthenticationSucceeded(FingerprintManager.AuthenticationResult re
522524 }
523525 byte [] decryptedBytes = cipher .doFinal (cipherBytes );
524526 pm .resolve (new String (decryptedBytes ));
525- } catch (InvalidKeyException e ) {
527+ } catch (InvalidKeyException | UnrecoverableKeyException e ) {
526528 try {
527529 mKeyStore .deleteEntry (KEY_ALIAS_AES );
528530 prepareKey ();
0 commit comments