Skip to content
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

KeyStoreException #42

Open
zzzSeMzzz opened this issue Sep 21, 2019 · 7 comments
Open

KeyStoreException #42

zzzSeMzzz opened this issue Sep 21, 2019 · 7 comments

Comments

@zzzSeMzzz
Copy link

In api 28
when call onCodeCompleted in MODE_AUTH

2019-09-21 11:53:36.606 6732-6732/ru.sem.migrant W/System.err: javax.crypto.IllegalBlockSizeException
2019-09-21 11:53:36.606 6732-6732/ru.sem.migrant W/System.err: at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:519)
2019-09-21 11:53:36.606 6732-6732/ru.sem.migrant W/System.err: at javax.crypto.Cipher.doFinal(Cipher.java:2055)
2019-09-21 11:53:36.606 6732-6732/ru.sem.migrant W/System.err: at com.beautycoder.pflockscreen.security.PFSecurityUtils.decode(PFSecurityUtils.java:135)
2019-09-21 11:53:36.606 6732-6732/ru.sem.migrant W/System.err: at com.beautycoder.pflockscreen.security.PFFingerprintPinCodeHelper.checkPin(PFFingerprintPinCodeHelper.java:65)
2019-09-21 11:53:36.606 6732-6732/ru.sem.migrant W/System.err: at com.beautycoder.pflockscreen.viewmodels.PFPinCodeViewModel.checkPin(PFPinCodeViewModel.java:31)
2019-09-21 11:53:36.606 6732-6732/ru.sem.migrant W/System.err: at com.beautycoder.pflockscreen.fragments.PFLockScreenFragment$6.onCodeCompleted(PFLockScreenFragment.java:311)
2019-09-21 11:53:36.606 6732-6732/ru.sem.migrant W/System.err: at com.beautycoder.pflockscreen.views.PFCodeView.input(PFCodeView.java:84)
2019-09-21 11:53:36.607 6732-6732/ru.sem.migrant W/System.err: at com.beautycoder.pflockscreen.fragments.PFLockScreenFragment$1.onClick(PFLockScreenFragment.java:187)
2019-09-21 11:53:36.607 6732-6732/ru.sem.migrant W/System.err: at android.view.View.performClick(View.java:6597)
2019-09-21 11:53:36.607 6732-6732/ru.sem.migrant W/System.err: at android.view.View.performClickInternal(View.java:6574)
2019-09-21 11:53:36.607 6732-6732/ru.sem.migrant W/System.err: at android.view.View.access$3100(View.java:778)
2019-09-21 11:53:36.607 6732-6732/ru.sem.migrant W/System.err: at android.view.View$PerformClick.run(View.java:25885)
2019-09-21 11:53:36.607 6732-6732/ru.sem.migrant W/System.err: at android.os.Handler.handleCallback(Handler.java:873)
2019-09-21 11:53:36.611 6732-6732/ru.sem.migrant W/System.err: at android.os.Handler.dispatchMessage(Handler.java:99)
2019-09-21 11:53:36.611 6732-6732/ru.sem.migrant W/System.err: at android.os.Looper.loop(Looper.java:193)
2019-09-21 11:53:36.612 6732-6732/ru.sem.migrant W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6669)
2019-09-21 11:53:36.612 6732-6732/ru.sem.migrant W/System.err: at java.lang.reflect.Method.invoke(Native Method)
2019-09-21 11:53:36.613 6732-6732/ru.sem.migrant W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
2019-09-21 11:53:36.613 6732-6732/ru.sem.migrant W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
2019-09-21 11:53:36.614 6732-6732/ru.sem.migrant W/System.err: Caused by: android.security.KeyStoreException: Unknown error
2019-09-21 11:53:36.614 6732-6732/ru.sem.migrant W/System.err: at android.security.KeyStore.getKeyStoreException(KeyStore.java:839)
2019-09-21 11:53:36.614 6732-6732/ru.sem.migrant W/System.err: at android.security.keystore.KeyStoreCryptoOperationChunkedStreamer.doFinal(KeyStoreCryptoOperationChunkedStreamer.java:224)
2019-09-21 11:53:36.614 6732-6732/ru.sem.migrant W/System.err: at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:506)

@joyceHong0524
Copy link

I have the same issue :( it must have been a change in android Keystore system

@thealeksandr
Copy link
Owner

@zzzSeMzzz @joyceHong0524 looking into it

@thealeksandr thealeksandr added this to the 1.0.0-beta7 milestone Nov 4, 2019
@thealeksandr
Copy link
Owner

@zzzSeMzzz @joyceHong0524 can you provide more details. What phone you using? What code length you trying to decrypt? Is it happens in 100% cases?

@joyceHong0524
Copy link

@thealeksandr It has been a while I got that error so I actually don't remember when it exactly happens but I was using Galaxy Note10 with Android 9. I will re-check the problem and give you more details if I have time

@kirkkhua
Copy link

kirkkhua commented Nov 13, 2019

I have the same error on Google Nexus 5 with Android 6.0.1.
The code is 4 digit and it happens in 100% cases.

11-13 15:38:42.676 W/System.err: javax.crypto.IllegalBlockSizeException
11-13 15:38:42.676 W/System.err:     at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:486)
11-13 15:38:42.676 W/System.err:     at javax.crypto.Cipher.doFinal(Cipher.java:1502)
11-13 15:38:42.676 W/System.err:     at com.beautycoder.pflockscreen.security.PFSecurityUtils.decode(PFSecurityUtils.java:135)
11-13 15:38:42.676 W/System.err:     at com.beautycoder.pflockscreen.security.PFFingerprintPinCodeHelper.checkPin(PFFingerprintPinCodeHelper.java:65)
11-13 15:38:42.676 W/System.err:     at com.beautycoder.pflockscreen.viewmodels.PFPinCodeViewModel.checkPin(PFPinCodeViewModel.java:31)
11-13 15:38:42.676 W/System.err:     at com.beautycoder.pflockscreen.fragments.PFLockScreenFragment$6.onCodeCompleted(PFLockScreenFragment.java:311)
11-13 15:38:42.676 W/System.err:     at com.beautycoder.pflockscreen.views.PFCodeView.input(PFCodeView.java:84)
11-13 15:38:42.676 W/System.err:     at com.beautycoder.pflockscreen.fragments.PFLockScreenFragment$1.onClick(PFLockScreenFragment.java:187)
11-13 15:38:42.676 W/System.err:     at android.view.View.performClick(View.java:5204)
11-13 15:38:42.676 W/System.err:     at android.view.View$PerformClick.run(View.java:21153)
11-13 15:38:42.676 W/System.err:     at android.os.Handler.handleCallback(Handler.java:739)
11-13 15:38:42.676 W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
11-13 15:38:42.676 W/System.err:     at android.os.Looper.loop(Looper.java:148)
11-13 15:38:42.676 W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5417)
11-13 15:38:42.676 W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
11-13 15:38:42.677 W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
11-13 15:38:42.677 W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
11-13 15:38:42.677 W/System.err: Caused by: android.security.KeyStoreException: Unknown error
11-13 15:38:42.677 W/System.err:     at android.security.KeyStore.getKeyStoreException(KeyStore.java:632)
11-13 15:38:42.677 W/System.err:     at android.security.keystore.KeyStoreCryptoOperationChunkedStreamer.doFinal(KeyStoreCryptoOperationChunkedStreamer.java:224)
11-13 15:38:42.678 W/System.err:     at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:473)
11-13 15:38:42.678 W/System.err: 	... 16 more

UPD: the same problem on Samsung SM-A510F (Android 7.0 API 24):

2019-11-13 16:05:11.612 W/System.err: javax.crypto.IllegalBlockSizeException
2019-11-13 16:05:11.614 W/System.err:     at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:519)
2019-11-13 16:05:11.614 W/System.err:     at javax.crypto.Cipher.doFinal(Cipher.java:2056)
2019-11-13 16:05:11.614 W/System.err:     at com.beautycoder.pflockscreen.security.PFSecurityUtils.decode(PFSecurityUtils.java:135)
2019-11-13 16:05:11.614 W/System.err:     at com.beautycoder.pflockscreen.security.PFFingerprintPinCodeHelper.checkPin(PFFingerprintPinCodeHelper.java:65)
2019-11-13 16:05:11.615 W/System.err:     at com.beautycoder.pflockscreen.viewmodels.PFPinCodeViewModel.checkPin(PFPinCodeViewModel.java:31)
2019-11-13 16:05:11.615 W/System.err:     at com.beautycoder.pflockscreen.fragments.PFLockScreenFragment$6.onCodeCompleted(PFLockScreenFragment.java:311)
2019-11-13 16:05:11.615 W/System.err:     at com.beautycoder.pflockscreen.views.PFCodeView.input(PFCodeView.java:84)
2019-11-13 16:05:11.615 W/System.err:     at com.beautycoder.pflockscreen.fragments.PFLockScreenFragment$1.onClick(PFLockScreenFragment.java:187)
2019-11-13 16:05:11.615 W/System.err:     at android.view.View.performClick(View.java:6261)
2019-11-13 16:05:11.615 W/System.err:     at android.widget.TextView.performClick(TextView.java:11163)
2019-11-13 16:05:11.615 W/System.err:     at android.view.View$PerformClick.run(View.java:23748)
2019-11-13 16:05:11.615 W/System.err:     at android.os.Handler.handleCallback(Handler.java:751)
2019-11-13 16:05:11.615 W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
2019-11-13 16:05:11.615 W/System.err:     at android.os.Looper.loop(Looper.java:154)
2019-11-13 16:05:11.615 W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:6776)
2019-11-13 16:05:11.616 W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
2019-11-13 16:05:11.616 W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
2019-11-13 16:05:11.616 W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
2019-11-13 16:05:11.616 W/System.err: Caused by: android.security.KeyStoreException: Unknown error
2019-11-13 16:05:11.616 W/System.err:     at android.security.KeyStore.getKeyStoreException(KeyStore.java:1112)
2019-11-13 16:05:11.616 W/System.err:     at android.security.keystore.KeyStoreCryptoOperationChunkedStreamer.doFinal(KeyStoreCryptoOperationChunkedStreamer.java:224)
2019-11-13 16:05:11.616 W/System.err:     at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:506)
2019-11-13 16:05:11.616 W/System.err: 	... 17 more

@rasoulmiri
Copy link

W/System.err: javax.crypto.IllegalBlockSizeException
W/System.err: at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:519)
W/System.err: at javax.crypto.Cipher.doFinal(Cipher.java:2055)
W/System.err: at com.beautycoder.pflockscreen.security.PFSecurityUtils.decode(PFSecurityUtils.java:135)
W/System.err: at com.beautycoder.pflockscreen.security.PFFingerprintPinCodeHelper.checkPin(PFFingerprintPinCodeHelper.java:65)
W/System.err: at com.beautycoder.pflockscreen.viewmodels.PFPinCodeViewModel.checkPin(PFPinCodeViewModel.java:33)
W/System.err: at com.beautycoder.pflockscreen.fragments.PFLockScreenFragment$6.onCodeCompleted(PFLockScreenFragment.java:343)
W/System.err: at com.beautycoder.pflockscreen.views.PFCodeView.input(PFCodeView.java:85)
W/System.err: at com.beautycoder.pflockscreen.fragments.PFLockScreenFragment$1.onClick(PFLockScreenFragment.java:219)
W/System.err: at android.view.View.performClick(View.java:7352)
W/System.err: at android.widget.TextView.performClick(TextView.java:14177)
W/System.err: at android.view.View.performClickInternal(View.java:7318)
W/System.err: at android.view.View.access$3200(View.java:846)
W/System.err: at android.view.View$PerformClick.run(View.java:27800)
W/System.err: at android.os.Handler.handleCallback(Handler.java:873)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err: at android.os.Looper.loop(Looper.java:214)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:7050)
W/System.err: at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
W/System.err: Caused by: android.security.KeyStoreException: Unknown error
W/System.err: at android.security.KeyStore.getKeyStoreException(KeyStore.java:1177)
W/System.err: at android.security.keystore.KeyStoreCryptoOperationChunkedStreamer.doFinal(KeyStoreCryptoOperationChunkedStreamer.java:224)
W/System.err: at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:506)
W/System.err: ... 19 more

SUMSUNG Gakaxy S8 Android 9

@thealeksandr
Copy link
Owner

@rasoulmiri can you reproduce with example project? (If you pull git repository and try to build it?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants