whorlwind icon indicating copy to clipboard operation
whorlwind copied to clipboard

No fingerprint enrolled crash

Open matt-jt opened this issue 8 years ago • 5 comments

This occurs after restarting one of the default Android emulators. After rebooting the emulator, it still shows a finger print registered. Adding a new one seems to fix the problem, but there seems to be some sort of underlying issue here. We are also seeing the same issue on a few Samsung and LG phones but have been unable reproduce it locally.

FATAL EXCEPTION: RxCachedThreadScheduler-1
   Process: com.squareup.whorlwind.sample, PID: 3221
   java.lang.IllegalStateException: Exception thrown on Scheduler.Worker thread. Add `onError` handling.
       at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:60)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
       at java.util.concurrent.FutureTask.run(FutureTask.java:237)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
       at java.lang.Thread.run(Thread.java:818)
    Caused by: rx.exceptions.OnErrorNotImplementedException: java.security.InvalidAlgorithmParameterException: java.lang.IllegalStateException: At least one fingerprint must be enrolled to create keys requiring user authentication for every use
       at rx.Observable$27.onError(Observable.java:8139)
       at rx.observers.SafeSubscriber._onError(SafeSubscriber.java:157)
       at rx.observers.SafeSubscriber.onError(SafeSubscriber.java:120)
       at rx.exceptions.Exceptions.throwOrReport(Exceptions.java:200)
       at rx.observers.SafeSubscriber.onNext(SafeSubscriber.java:144)
       at rx.internal.util.ScalarSynchronousObservable$ScalarAsyncProducer.call(ScalarSynchronousObservable.java:200)
       at rx.internal.util.ScalarSynchronousObservable$3$1.call(ScalarSynchronousObservable.java:128)
       at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423) 
       at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269) 
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
       at java.lang.Thread.run(Thread.java:818) 
    Caused by: java.lang.RuntimeException: java.security.InvalidAlgorithmParameterException: java.lang.IllegalStateException: At least one fingerprint must be enrolled to create keys requiring user authentication for every use
       at com.squareup.whorlwind.RealWhorlwind.prepareKeyStore(RealWhorlwind.java:153)
       at com.squareup.whorlwind.RealWhorlwind.write(RealWhorlwind.java:102)
       at com.squareup.whorlwind.sample.SampleActivity.lambda$onCreate$1(SampleActivity.java:76)
       at com.squareup.whorlwind.sample.SampleActivity.access$lambda$1(SampleActivity.java)
       at com.squareup.whorlwind.sample.SampleActivity$$Lambda$5.call(Unknown Source)
       at rx.Observable$27.onNext(Observable.java:8144)
       at rx.observers.SafeSubscriber.onNext(SafeSubscriber.java:139)
       at rx.internal.util.ScalarSynchronousObservable$ScalarAsyncProducer.call(ScalarSynchronousObservable.java:200) 
       at rx.internal.util.ScalarSynchronousObservable$3$1.call(ScalarSynchronousObservable.java:128) 
       at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55) 
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423) 
       at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269) 
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
       at java.lang.Thread.run(Thread.java:818) 
    Caused by: java.security.InvalidAlgorithmParameterException: java.lang.IllegalStateException: At least one fingerprint must be enrolled to create keys requiring user authentication for every use
       at android.security.keystore.AndroidKeyStoreKeyPairGeneratorSpi.initialize(AndroidKeyStoreKeyPairGeneratorSpi.java:339)
       at java.security.KeyPairGenerator$KeyPairGeneratorImpl.initialize(KeyPairGenerator.java:284)
       at java.security.KeyPairGenerator.initialize(KeyPairGenerator.java:192)
       at com.squareup.whorlwind.RealWhorlwind.prepareKeyStore(RealWhorlwind.java:144)
       at com.squareup.whorlwind.RealWhorlwind.write(RealWhorlwind.java:102) 
       at com.squareup.whorlwind.sample.SampleActivity.lambda$onCreate$1(SampleActivity.java:76) 
       at com.squareup.whorlwind.sample.SampleActivity.access$lambda$1(SampleActivity.java) 
       at com.squareup.whorlwind.sample.SampleActivity$$Lambda$5.call(Unknown Source) 
       at rx.Observable$27.onNext(Observable.java:8144) 
       at rx.observers.SafeSubscriber.onNext(SafeSubscriber.java:139) 
       at rx.internal.util.ScalarSynchronousObservable$ScalarAsyncProducer.call(ScalarSynchronousObservable.java:200) 
       at rx.internal.util.ScalarSynchronousObservable$3$1.call(ScalarSynchronousObservable.java:128) 
       at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55) 
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423) 
       at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269) 
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
       at java.lang.Thread.run(Thread.java:818) 
    Caused by: java.lang.IllegalStateException: At least one fingerprint must be enrolled to create keys requiring user authentication for every use
       at android.security.keystore.KeymasterUtils.addUserAuthArgs(KeymasterUtils.java:115)
       at android.security.keystore.AndroidKeyStoreKeyPairGeneratorSpi.initialize(AndroidKeyStoreKeyPairGeneratorSpi.java:335)
       at java.security.KeyPairGenerator$KeyPairGeneratorImpl.initialize(KeyPairGenerator.java:284) 
       at java.security.KeyPairGenerator.initialize(KeyPairGenerator.java:192) 
       at com.squareup.whorlwind.RealWhorlwind.prepareKeyStore(RealWhorlwind.java:144) 
       at com.squareup.whorlwind.RealWhorlwind.write(RealWhorlwind.java:102) 
       at com.squareup.whorlwind.sample.SampleActivity.lambda$onCreate$1(SampleActivity.java:76) 
       at com.squareup.whorlwind.sample.SampleActivity.access$lambda$1(SampleActivity.java) 
       at com.squareup.whorlwind.sample.SampleActivity$$Lambda$5.call(Unknown Source) 
       at rx.Observable$27.onNext(Observable.java:8144) 
       at rx.observers.SafeSubscriber.onNext(SafeSubscriber.java:139) 
       at rx.internal.util.ScalarSynchronousObservable$ScalarAsyncProducer.call(ScalarSynchronousObservable.java:200) 
       at rx.internal.util.ScalarSynchronousObservable$3$1.call(ScalarSynchronousObservable.java:128) 
       at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55) 
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423) 
       at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269) 
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
       at java.lang.Thread.run(Thread.java:818) 

matt-jt avatar Aug 15 '16 20:08 matt-jt

I've been trying to reproduce this crash on Samsung for months... I'll try restarting the phone a bunch of times and see if it'll repro.

If this is the cause then I don't think there's anything I can do in the library to fix this. It's a major issue in the OS.

mattprecious avatar Aug 15 '16 20:08 mattprecious

@mattprecious glad to hear I'm not the only one experiencing this. While doing some research I found the same bug in the google samples finger print dialog section with multiple people pointing to an emulator problem. From the fabric crash logs though, the same issue/crash is occurring on multiple Samsung and LG devices.

matt-jt avatar Aug 16 '16 11:08 matt-jt

Bump. Seeing this issue on LG V10. Cant repo, only seen in the crash logs on the play console.

mitchross avatar Aug 16 '16 12:08 mitchross

It's easy to reproduce this on AVD emulators. Problem is that fingerprintManager.hasEnrolledFingerprints() returns true, but calling RealWhorlwind#prepareKeyStore() throws an exception in lines

      keyGenerator.initialize(new KeyGenParameterSpec.Builder(keyAlias,
          KeyProperties.PURPOSE_ENCRYPT | KeyProperties.PURPOSE_DECRYPT) //
          .setBlockModes(KeyProperties.BLOCK_MODE_ECB) //
          .setUserAuthenticationRequired(true) //
          .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_RSA_PKCS1) //
          .build());

Exception: java.lang.IllegalStateException: At least one fingerprint must be enrolled to create keys requiring user authentication for every use

Adding new fingerprint solves problem until next emulator reboot. So far I didn't experience this problem on any real device.

Kamil-Kaminski avatar Mar 15 '17 09:03 Kamil-Kaminski

I've tested the no fingerprint enrolled case just recently with a Pixel 2 and the current master (with RxJava 2 support) and it worked without any issues.

Given that this issue is quite old should we close this? In case this pops up again one can open up a new one.

vanniktech avatar Feb 09 '18 19:02 vanniktech