SelfLender / react-native-biometrics

React Native module for iOS and Android biometrics
MIT License
664 stars 228 forks source link

Consider Using TMP/Secure enclave? #174

Open krapgras opened 2 years ago

krapgras commented 2 years ago

Hello All,

Has it been considered to implement a optional option to change the signature creation to only work if the device has a TPM/Secure enclave? Otherwise you could still get the private key on a fully owned device. The risk of this is of course lower then Event-based verification but it would still improve security and use hardware encryption for what it was intended for.

For android this would be as easy as checking the setIsStrongBoxBacked function when doing the KeyGenParameterSpec.Builder.

https://developer.android.com/reference/android/security/keystore/KeyGenParameterSpec.Builder#setIsStrongBoxBacked(boolean)

And for IOS it would mean to change the kSecAttrKeyType to kSecAttrKeyTypeEC and the kSecAttrTokenID to kSecAttrTokenIDSecureEnclave

As mentioned in these documents:

https://developer.apple.com/documentation/security/ksecattrtokenidsecureenclave

https://medium.com/@alx.gridnev/ios-keychain-using-secure-enclave-stored-keys-8f7c81227f4

rikur commented 1 year ago

Is anyone working on this?