问题
we are currently trying to sign data with biometrics, which we use the androidx.biometric library for.
The Problem is, if no Fingerprint ist installed but a face registered we cannot generate any keys.
With Fingerprint only or with the combination of fingerprint and face everything works perfect.
With only the face registered we get the following exception during key generation:
Caused by: java.security.InvalidAlgorithmParameterException: java.lang.IllegalStateException: At least one biometric must be enrolled to create keys requiring user authentication for every use
Before we start the key generation we test the presence of biometric as following:
boolean isAvailable = biometricManager.canAuthenticate() == BiometricManager.BIOMETRIC_SUCCESS;
The Test-Device as a Samsung Galaxy S10 with Android 10.
Thank you for help and best regards
回答1:
Google has updated androidx biometric sdk. If you are going to use strong type authentication in your application.Authentication can be checked for the strong type. If your device is suitable for this, you can create a cryptoObject.
https://developer.android.com/jetpack/androidx/releases/biometric#1.1.0-alpha02
https://developer.android.com/reference/android/hardware/biometrics/BiometricManager#canAuthenticate(int)
val canAuthenticate = BiometricManager.from (context)
.canAuthenticate (BiometricManager.Authenticators.BIOMETRIC_STRONG)
After this check, you can proceed to key generation.
来源:https://stackoverflow.com/questions/61698257/keygeneration-using-androidx-biometric-fails-if-only-face-as-biometric-is-instal