Git Product home page Git Product logo

authenticate-me's Introduction

Authenticate me. If you can...

This repository contains the source code for my article (habr, medium) about PIN & Biometrics authentication methods in Android apps.

Structure

For your comfort the repository is divided by several branches according to the article structure:

Each branch contains the final solution for the corresponding step.

Architecture

This project is not about the right architecture™, but rather about authentication and security principles behind this process. Feel free to adapt these approaches to your needs.

authenticate-me's People

Contributors

fi5t avatar martofeld avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

martofeld dimsuz

authenticate-me's Issues

javax.crypto.IllegalBlockSizeException when logging in

Found this repository through the article and thought it was great. While giving it a try I found a crash that might be worth noticing.

Steps to reproduce:

  1. Use biometrics to authenticate
  2. On the AuthorizedFragment hit back
  3. Land in the "login" page again and the prompt opens up
  4. Use Biometrics again to authenticate
  5. See the Stack Trace below

Tested in both Android API 28 and 29

The reason is that we are using the same crypto object to authenticate twice because when you go back and re-subscribe to the biometricParams live data its sending the previous params

Process: com.redmadrobot.authenticateme, PID: 18327
    java.lang.Error: javax.crypto.IllegalBlockSizeException
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1173)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)
     Caused by: javax.crypto.IllegalBlockSizeException
        at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:519)
        at javax.crypto.Cipher.doFinal(Cipher.java:2055)
        at com.redmadrobot.authenticateme.unauthorized_zone.login.pin.input.InputPinViewModel$authenticationCallback$1.onAuthenticationSucceeded(InputPinViewModel.kt:53)
        at androidx.biometric.BiometricFragment$2$2.run(BiometricFragment.java:138)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:919) 
     Caused by: android.security.KeyStoreException: Key user not authenticated
        at android.security.KeyStore.getKeyStoreException(KeyStore.java:1292)
        at android.security.keystore.KeyStoreCryptoOperationChunkedStreamer.update(KeyStoreCryptoOperationChunkedStreamer.java:132)
        at android.security.keystore.KeyStoreCryptoOperationChunkedStreamer.doFinal(KeyStoreCryptoOperationChunkedStreamer.java:217)
        at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:506)

[Question] - Do we need cipher?

Hello,

First of all, awesome article and even awesome repo. Just a quick question:
Since nowadays we have EncryptedSharedPreferences do we really need to use Pbkdf2Factory and all that logic of coding and decoding to safely store the pin? In your sample you end up using EncryptedSharedPreferencesbut you use another security layer on top of it. Is it just another security layer or it has other purposes?

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.