Skip to content

Commit c9c9c47

Browse files
committed
Merge branch 'master' into feature/keystoreAsDefault
2 parents e51e5d0 + ff7593c commit c9c9c47

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

.all-contributorsrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@
1616
"review",
1717
"ideas"
1818
]
19+
},
20+
{
21+
"login": "maggialejandro",
22+
"name": "Alejandro",
23+
"avatar_url": "https://avatars1.githubusercontent.com/u/3394748?v=4",
24+
"profile": "https://github.com/maggialejandro",
25+
"contributions": [
26+
"code",
27+
"maintenance"
28+
]
1929
}
2030
],
2131
"contributorsPerLine": 7,

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
4040
<table>
4141
<tr>
4242
<td align="center"><a href="https://mcodex.github.io"><img src="https://avatars2.githubusercontent.com/u/5920613?v=4" width="100px;" alt=""/><br /><sub><b>Mateus Andrade</b></sub></a><br /><a href="https://github.com/mCodex/react-native-sensitive-info/commits?author=mcodex" title="Documentation">📖</a> <a href="https://github.com/mCodex/react-native-sensitive-info/commits?author=mcodex" title="Code">💻</a> <a href="https://github.com/mCodex/react-native-sensitive-info/pulls?q=is%3Apr+reviewed-by%3Amcodex" title="Reviewed Pull Requests">👀</a> <a href="#ideas-mcodex" title="Ideas, Planning, & Feedback">🤔</a></td>
43+
<td align="center"><a href="https://github.com/maggialejandro"><img src="https://avatars1.githubusercontent.com/u/3394748?v=4" width="100px;" alt=""/><br /><sub><b>Alejandro</b></sub></a><br /><a href="https://github.com/mCodex/react-native-sensitive-info/commits?author=maggialejandro" title="Code">💻</a> <a href="#maintenance-maggialejandro" title="Maintenance">🚧</a></td>
4344
</tr>
4445
</table>
4546

android/src/main/java/br/com/classapp/RNSensitiveInfo/RNSensitiveInfoModule.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import java.security.PrivateKey;
3939
import java.security.PublicKey;
4040
import java.util.Calendar;
41+
import java.security.UnrecoverableKeyException;
4142
import java.util.HashMap;
4243
import java.util.Map;
4344
import 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

Comments
 (0)