Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BiometricSample - not necessary assertion when running on SDK 30 #18

Open
java-crypto opened this issue Jul 6, 2021 · 0 comments
Open

Comments

@java-crypto
Copy link

First of all - Thanks for your excellent code regarding Biometric on Android, I did not find any examples
that are so extensive and are running "out of the box".

My point is not really an issue, but maybe you like to correct it.

When running your code on SDK 30 and choosing the option "Device credential" only
(so no checked "Strong biometric" and "Weak biometric" option) and using "Authenticate + Encrypt"
I get the error message "Authentication type must be strong to authenticate with crypto on API levels >= 30" that is caused
by line 76 of BiometricAuthenticatorApi30.kt:

private fun canAuthenticateWithCrypto(): Boolean {
    if (getSecretKeyType() and KeyProperties.AUTH_BIOMETRIC_STRONG == 0) {
        listener.onNewMessage(
            "Authentication type must be strong to authenticate with crypto" +
                    " on API levels >= 30"
        )
        return false
    }
    return true
}

This assertion seems to be not correct, the docs say nothing about this:

https://developer.android.com/training/sign-in/biometric-auth#java

When deactivating the function (or, for testing purposes, change "return false" to "return true" as well)
the program is running and gives an encrypted output.

Warm greetings
Michael

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant