Skip to content

very simple project showing how to use jose4j with Android keystore system keys requiring user biometric authentication for use

Notifications You must be signed in to change notification settings

b---c/Jose4jBioPromptExample

Repository files navigation

jose4j BiometricPrompt AndroidKeyStore Example App

A very simple Android project that shows how to use jose4j with Android keystore system keys that require user biometric authentication for use. This could be used, for example, to require that the user present a biometric each time a particular key is used to sign a JWT.

MainActivity is where the magic happens, so look there to see the actual workings. But basically, after setting the private key on the JWS or JWE object, calling the prepareSigningPrimitive or prepareDecryptingPrimitive() method respectively will allow access to the underlying Signature or Cipher, which can be used to set up a BiometricPrompt.CryptoObject that can authorize use of the crypto object by showing a biometric authentication dialog to the user.

To run it:

  1. Open project in android studio
  2. Create/pick a destination to run on - emulator or device
  3. Ensure your chosen device has finger print and a lock pattern or pin enabled using the 'Security' section of the on-device settings app
  4. Run the project (on a device or an emulator)
  5. Enter some text and tap the button to "Sign & Verify" or "Encrypt & Decrypt"
  6. Present fingerprint when prompted (on the emulator, hit the '...' on the toolbar on the right hand side to open 'Extended Controls' then select 'Fingerprint' and 'touch the sensor')
  7. The text as well as the actual JWS or JWE will be shown
  8. Profit?

About

very simple project showing how to use jose4j with Android keystore system keys requiring user biometric authentication for use

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages