Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Android Fingerprint API - A crash-course in fingerprint authentication

Mauin
July 26, 2017

Android Fingerprint API - A crash-course in fingerprint authentication

This talk covers the basics of the Android Fingerprint API and how to use it to authenticate your users in a secure manner. Learn how to build an authentication flow with the fingerprint API, how to build the UI and why you should consider using the fingerprint API in the first place.
This talk also covers how to encrypt and decrypt secrets using the users fingerprint to keep their data safe and secure.

Mauin

July 26, 2017
Tweet

More Decks by Mauin

Other Decks in Programming

Transcript

  1. Nougat 11,5 % Marshmallow 31,8 % Lollipop 30,1 % KitKat

    17,1 % Jelly Bean 8,1 % Data from July 6, 2017
  2. Nougat 11,5 % Marshmallow 31,8 % Lollipop 30,1 % KitKat

    17,1 % Jelly Bean 8,1 % Data from July 6, 2017 43%!
  3. Nougat 11,5 % Marshmallow 31,8 % Lollipop 30,1 % KitKat

    17,1 % Jelly Bean 8,1 % Data from July 6, 2017 <43%
  4. Nougat 11,5 % Marshmallow 31,8 % Lollipop 30,1 % KitKat

    17,1 % Jelly Bean 8,1 % Data from July 6, 2017 <<43%
  5. Passwords Entering a password with a tiny keyboard Forgot password

    Your users just want to authenticate themselves
  6. Requirements Android Marshmallow or above (targetSdk 23+) USE_FINGERPRINT permission in

    AndroidManifest.xml Fingerprint reader Fingerprint unlock setup Device specifies FEATURE_FINGERPRINT
  7. Things the Fingerprint API can’t do Give you an image

    of the fingerprint Run in the background (*) (tell you which finger was detected)
  8. #onAuthenticationError Unrecoverable Error Fingerprint operation will be cancelled Too many

    unsuccessful tries Fingerprint sensor “locked down” Operation cancelled
  9. UX Let the user choose to use Fingerprint Provide a

    fallback Show the correct success and error states Show the help messages
  10. CryptoObject Wraps Java crypto classes Backed by Android KeyStore Keys

    can be restricted to biometric authentication setUserAuthenticationRequired
  11. CryptoObject crash-course Call FingerprintManager#authenticate(…) with CryptoObject #onAuthenticationSuccess val cipher: Cipher

    = authenticationResult.cryptoObject.cipher val encrypted: ByteArray = cipher.doFinal("1234".toByteArray())
  12. Key generation and invalidation val builder = KeyGenParameterSpec.Builder(KEY_NAME, PURPOSE) .setKeySize(...)

    .setBlockModes(...) .setEncryptionPaddings(...) .setUserAuthenticationRequired(true) .setUserAuthenticationValidWhileOnBody(false) .setUserAuthenticationValidityDurationSeconds(60) .setInvalidatedByBiometricEnrollment(true) Changing the lockscreen can invalidate all fingerprint backed keys! CryptoObject will throw KeyPermanentlyInvalidatedException
  13. Security Considerations It’s a fingerprint - not necessarily your user

    Passwords might be stronger Fingerprints can’t change But fingerprint sensors are convenient…
  14. Samples developer.android.com Material.io: Patterns - Fingerprint GitHub: Google Fingerprint Dialog

    Sample GitHub: mattprecious/swirl GitHub: RxFingerprint GitHub: square/whorlwind