-
Notifications
You must be signed in to change notification settings - Fork 131
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
InvalidAlgorithmParmeterException in createKey() causes crash #4
Comments
FYI to reproduce this bug:
NOTE: if you then simulate locking and unlocking the emulator with the fingerprint (instead of PIN) then the plugin works fine! |
Hi @scottmcnab did you get any solutions? |
Is this an emulator only error, or is it showing up on hardware devices as well? Shall I then abort the call upon catching that exception to prevent the crash, or would that just be masking the problem? It would not change the fact that you would be unable to use fingerprint authentication. |
Hi @mjwheatley I am facing this in Hardware device (Samsung S6 Edge Device). |
I have published v0.0.8 to improve the error handling in order to prevent the plugin from causing the application to crash. Now if the cipher fails to initialize the backup activity will be launched and ask for the backup pin, password, or pattern. If you validate using a fingerprint on this screen it seems to resolve the issue with the key being permanently revoked which seemed to be causing the cipher from being initialized. Please test it out and let me know if it helps resolve this issue. |
While testing this plugin on Android 6 emulator, I get unexpected app termination attempting to call FingerprintAuth.show() (after a successful call to FingerprintAuth.isAvailable() that indicates fingerprints are available and enrolled):
V/FingerprintAuth: Init FingerprintAuth
V/FingerprintAuth: FingerprintAuth action: availability
W/CordovaPlugin: Attempted to send a second callback for ID: FingerprintAuth1796866245
Result was: "OK"
V/FingerprintAuth: FingerprintAuth action: authenticate
W/CordovaPlugin: Attempted to send a second callback for ID: FingerprintAuth1796866267
Result was: "Error"
W/CordovaPlugin: Attempted to send a second callback for ID: FingerprintAuth1796866267
Result was: "InvalidKeyException"
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.myapp, PID: 1019
java.lang.NullPointerException: Attempt to invoke virtual method 'void com.cordova.plugin.android.fingerprintauth.FingerprintAuthenticationDialogFragment.setCryptoObject(android.hardware.fingerprint.FingerprintManager$CryptoObject)' on a null object reference
at com.cordova.plugin.android.fingerprintauth.FingerprintAuth$1.run(FingerprintAuth.java:196)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Details:
Investigating with debugger shows InvalidAlgorithmParameterException raised (and caught) in createKey() method with this message (when executing the "authenticate" action):
"java.lang.IllegalStateException: At least one fingerprint must be enrolled to create keys requiring user authentication for every use"
Since this error case is never acted on to abort the call, this in turn causes initCipher() to fail with InvalidKeyException (message "Unsupported key: null"), falling through to the "else" statement, whereby mFragment is null as it is never initialised (hence crash).
Any idea what is causing this or how to fix it? Thanks!
The text was updated successfully, but these errors were encountered: