KeyGeneration using AndroidX.Biometric fails if only face as biometric is installed

断了今生、忘了曾经 提交于 2020-12-04 19:16:31

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!