biometricks
biometricks copied to clipboard
got "At least one biometric must be enrolled to create keys requiring user authentication for every use" on samsung galaxy A20
i have that phone with android 10 and decided to give this a shot. on phone settings menu, I've set the face unlock up. it works flawlessly if I use it as face unlock. but when I use this example to my android project, the error shows up please fix
I'm getting same error for two different devices as below.
- Realme X2, Android 10, no biometrics(Finger print or Face id), Password enrolled (numbers 6 digits)
- Motorola X4, Android 9, no biometrics(Finger print or Face id), PIN enrolled (numbers 4 digits)
Below I have attached log-cats.
2021-01-15 01:00:59.935 13489-13489/com.handstandsam.biometricks.sample E/AndroidRuntime: FATAL EXCEPTION: main Process: com.handstandsam.biometricks.sample, PID: 13489 java.security.InvalidAlgorithmParameterException: java.lang.IllegalStateException: At least one biometric must be enrolled to create keys requiring user authentication for every use at android.security.keystore.AndroidKeyStoreKeyGeneratorSpi.engineInit(AndroidKeyStoreKeyGeneratorSpi.java:256) at android.security.keystore.AndroidKeyStoreKeyGeneratorSpi$AES.engineInit(AndroidKeyStoreKeyGeneratorSpi.java:53) at javax.crypto.KeyGenerator.init(KeyGenerator.java:519) at javax.crypto.KeyGenerator.init(KeyGenerator.java:502) at com.handstandsam.biometricks.sample.Crypto.createKey(Crypto.kt:91) at com.handstandsam.biometricks.sample.Crypto.cryptoObject(Crypto.kt:20) at com.handstandsam.biometricks.sample.MainActivity$showBiometricPrompt$1$cryptoObject$1.invokeSuspend(MainActivity.kt:59) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:241) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594) at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:740) Caused by: java.lang.IllegalStateException: At least one biometric must be enrolled to create keys requiring user authentication for every use at android.security.keystore.KeymasterUtils.addUserAuthArgs(KeymasterUtils.java:148) at android.security.keystore.AndroidKeyStoreKeyGeneratorSpi.engineInit(AndroidKeyStoreKeyGeneratorSpi.java:254) at android.security.keystore.AndroidKeyStoreKeyGeneratorSpi$AES.engineInit(AndroidKeyStoreKeyGeneratorSpi.java:53) at javax.crypto.KeyGenerator.init(KeyGenerator.java:519) at javax.crypto.KeyGenerator.init(KeyGenerator.java:502) at com.handstandsam.biometricks.sample.Crypto.createKey(Crypto.kt:91) at com.handstandsam.biometricks.sample.Crypto.cryptoObject(Crypto.kt:20) at com.handstandsam.biometricks.sample.MainActivity$showBiometricPrompt$1$cryptoObject$1.invokeSuspend(MainActivity.kt:59) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:241) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594) at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:740)
Same Issue facing me....
I am testing OPPO F19 Pro ....
private val hasFace = packageManager.hasSystemFeature(PackageManager.FEATURE_FACE)
private val hasFingerprint = packageManager.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)
```it's give me Face: True & Finger: True
I'm going to go ahead and mark this project as archived.
After the release of a lot of new devices from Samsung as well as the Google Pixel 7, there are many types of biometrics on the same device, and the OS is purposefully not allowing the correct detection.
Here is the ticket requesting the functionality from Google. I think that's the only reliable path forward: https://issuetracker.google.com/issues/111315641