-
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
No token returned when using PIN backup #85
Comments
Currently, it is that way by design. So you are saying you don't care if they authenticated with a fingerprint or the back up credentials, either way you want to encrypt or decrypt a token? |
Thanks for the quick response! I am implementing an option to authenticate with a fingerprint or PIN to give users an easier, faster way to log in instead of typing in their password. I'm hoping to include the PIN option only because not all devices will have a fingerprint reader. I created a fork and have been trying to figure out how to get an authenticated cipher from the backup authentication response but with no success so far. |
ok, I just started looking into it as well. I think the key is looking at the CryptoObject. |
Yep, that seemed to do the trick. |
* Fixed issue #85 No token returned when using PIN backup
Wow, thanks! |
Actually, I'm still getting an illegalblocksizeexception here when encrypting using a PIN. Are you seeing that? |
Probably because there are 2 flows to get to the backup credentials.
In both cases the cipher has not been initialized and the secret key could may not have been generated. Do you know which user flow is initiating the backup credentials activity ( 1 or 2)? It probably worked for me because I had previously authenticated with a fingerprint and created a secret key and initialized my cipher. So to make this work properly I will need to insure those both get initialized if not isFingerprintAvailable(). |
* create key and init cipher if only using backup credentials.
Please test the commit I just pushed and let me know if that helps with the issue. If so, I will publish the fix. |
I've been unable to get getSecretKey to return a null key or initCipher to return false in my testing.
This flow doesn't seem to work at all. I never get the response to hit any breakpoints in onActivityResult found in either FingerprintAuth or FingerprintAuthenticationDialogFragment. Looks like in this scenario, the fragment is never initialized, which explains why the breakpoint isn't hit in that class, but I don't see why I can't get into onActivityResult in FingerprintAuth. After the correct PIN is entered, the PIN screen closes with no response and no messages in the log. |
Sorry, Those flows may have hard to follow. Let me try to clarify. |
Hey, sorry for not getting back to you right away. I've been doing some testing and tinkering on my end. I think I'm going to have to either scrap the PIN idea or figure out a different way to do it. I was originally looking to do something similar to the Mint or other banking apps where you can actually set your own PIN to authenticate with, but I figured the unlocking PIN would be ok instead since that's what your plugin uses. If I use the plugin on a device with no fingerprint ability, I get a InvalidAlgorithmParameterException when generating the key because there are no fingerprints registered. Thanks for your help! I think I'm just going to use fingerprint only for now. |
Thanks mjwheatley for writing this plugin! Just added it to my app and I'm having the same problem as maleriepace If I attempt to "USE BACKUP" (device's PIN unlock) to encrypt or decrypt, I get ILLEGAL_BLOCK_SIZE_EXCEPTION Going to have to set disableBackup = true (not ideal) until we can get this fixed. Let me know if there is any way to help test. |
Hi @walternicholas, |
If you are able to debug, can you provide the line of code that is causing the exception?
|
Testing on an LG Nexus 5X and also an OnePlus 3 (https://oneplus.net/3).
Both have fingerprint hardware. Both had registered fingerprints. Same
results on both.
I'll hop in and do some debugging and get back to you with which line is
throwing that error.
|
Yes that is the exact error I'm seeing printed in logcat, coming from the block of code you posted (623-626 in FingerprintAuth.java). This error when I am trying to decrypt appears, after these 3 steps:
|
So you have to have a failed attempt first for the backup button to appear? Is this device specific or a custom implementation. The backup button is always present when testing on my Nexus 6p. |
Is the e.toString() printing out any additional information? |
Actually no that was my mistake, I didn't notice the USE BACKUP button on my first try. Was editing my comment to fix that when you posted. I still get the same problem, encrypting or decrypting, with or without first providing a wrong fingerprint before hitting USE BACKUP. |
From logcat: |
Can you tell which line in the try block, lines 578 - 618, is triggering the catch? |
I'm guessing that it may be line 605-606
Referencing https://developer.android.com/reference/javax/crypto/Cipher.html Public methods
Throws IllegalBlockSizeException |
@walternicholas if possible, perhaps we can arrange a time to investigate this together. Would you be agreeable to that? |
@mjwheatley Yeah I'd be happy to help investigate. What time works for you? |
Contact me at mattjwheatley@gmail.com and we can coordinate. |
Fixed by setting |
Hi, |
You can fork the repository and edit the layout. |
When I use the backup method, it doesn't seem that the password is encrypted and stored. Do you have an example of how withBackup should be implemented?
The text was updated successfully, but these errors were encountered: