Secured-Preference-Store icon indicating copy to clipboard operation
Secured-Preference-Store copied to clipboard

IllegalBlocksizeException Huawei p8 lite ALE-L21

Open fermedina opened this issue 8 years ago • 9 comments

Hi. I have an issue similar to 18. When I try store an string in Huawei p8 lite ALE-L21 I get this error:

10-24 14:49:24.216 10624-10721/com.twogetherbank.app W/System.err: javax.crypto.IllegalBlockSizeException
10-24 14:49:24.221 10624-10721/com.twogetherbank.app W/System.err:     at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:486)
10-24 14:49:24.221 10624-10721/com.twogetherbank.app W/System.err:     at javax.crypto.Cipher.doFinal(Cipher.java:1505)
10-24 14:49:24.221 10624-10721/com.twogetherbank.app W/System.err:     at devliving.online.securedpreferencestore.EncryptionManager.encryptAES(EncryptionManager.java:401)
10-24 14:49:24.221 10624-10721/com.twogetherbank.app W/System.err:     at devliving.online.securedpreferencestore.EncryptionManager.encrypt(EncryptionManager.java:242)
10-24 14:49:24.222 10624-10721/com.twogetherbank.app W/System.err:     at devliving.online.securedpreferencestore.EncryptionManager.tryEncrypt(EncryptionManager.java:175)
10-24 14:49:24.222 10624-10721/com.twogetherbank.app W/System.err:     at devliving.online.securedpreferencestore.EncryptionManager.encrypt(EncryptionManager.java:287)
10-24 14:49:24.222 10624-10721/com.twogetherbank.app W/System.err:     at devliving.online.securedpreferencestore.SecuredPreferenceStore$Editor.putString(SecuredPreferenceStore.java:232)
10-24 14:49:24.222 10624-10721/com.twogetherbank.app W/System.err:     at com.twogetherbank.app.utils.managers.CategoryManager$loadCategoriesFromServer$1.invoke(CategoryManager.kt:64)
10-24 14:49:24.222 10624-10721/com.twogetherbank.app W/System.err:     at com.twogetherbank.app.utils.managers.CategoryManager$loadCategoriesFromServer$1.invoke(CategoryManager.kt:18)
10-24 14:49:24.222 10624-10721/com.twogetherbank.app W/System.err:     at org.jetbrains.anko.AsyncKt$doAsync$1.invoke(Async.kt:140)
10-24 14:49:24.222 10624-10721/com.twogetherbank.app W/System.err:     at org.jetbrains.anko.AsyncKt$doAsync$1.invoke(Async.kt)
10-24 14:49:24.222 10624-10721/com.twogetherbank.app W/System.err:     at org.jetbrains.anko.AsyncKt$sam$Callable$761a5578.call(Async.kt)
10-24 14:49:24.224 10624-10721/com.twogetherbank.app W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
10-24 14:49:24.224 10624-10721/com.twogetherbank.app W/System.err:     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:154)
10-24 14:49:24.224 10624-10721/com.twogetherbank.app W/System.err:     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269)
10-24 14:49:24.224 10624-10721/com.twogetherbank.app W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
10-24 14:49:24.224 10624-10721/com.twogetherbank.app W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
10-24 14:49:24.224 10624-10721/com.twogetherbank.app W/System.err:     at java.lang.Thread.run(Thread.java:833)
10-24 14:49:24.224 10624-10721/com.twogetherbank.app W/System.err: Caused by: android.security.KeyStoreException: -65536
10-24 14:49:24.225 10624-10721/com.twogetherbank.app W/System.err:     at android.security.KeyStore.getKeyStoreException(KeyStore.java:632)
10-24 14:49:24.225 10624-10721/com.twogetherbank.app W/System.err:     at android.security.keystore.KeyStoreCryptoOperationChunkedStreamer.update(KeyStoreCryptoOperationChunkedStreamer.java:132)
10-24 14:49:24.225 10624-10721/com.twogetherbank.app W/System.err:     at android.security.keystore.KeyStoreCryptoOperationChunkedStreamer.doFinal(KeyStoreCryptoOperationChunkedStreamer.java:217)
10-24 14:49:24.225 10624-10721/com.twogetherbank.app W/System.err:     at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:473)
10-24 14:49:24.225 10624-10721/com.twogetherbank.app W/System.err: 	... 17 more

In others devices the library works fine.

Can you help me?

fermedina avatar Oct 24 '17 12:10 fermedina

Hi! I have the same problems in all Huawei devices. What is the problem?

fermedina avatar Nov 21 '17 09:11 fermedina

So the library is not working at all on those devices? Or does this happen after you've changed PIN/Password/Fingerprint of the device? And please share the OS version and the type of screen security you had in place.

iamMehedi avatar Nov 30 '17 10:11 iamMehedi

Hi, same problem here.. Android O is the OS and the device is a Nexus6 Emulator. Trying to put a jsonString from GSon library. GSon.toJson(string)

Gaetano-Dati avatar Jan 15 '18 17:01 Gaetano-Dati

@Gaetano-Dati thanks for the info. I'll see if I can reproduce it and find out the reason behind it.

iamMehedi avatar Jan 17 '18 04:01 iamMehedi

So did you come out and find the solution? Thanks

Gaetano-Dati avatar Jan 30 '18 07:01 Gaetano-Dati

@Gaetano-Dati Tried the sample app on A Nexus 6 emulator with Android O (with google APIs) but couldn't reproduce the issue.

iamMehedi avatar Feb 01 '18 06:02 iamMehedi

The issue was reproduced on a physical device during a robo test by firebase. The error is at the moment the Application class gets called. I didn't experience this error on one of my devices but I don't have a Huawei. I emulated the Application on a Nexus 6 with Android O and It didn't give me the error. Have you got a Huawei physical devices in order to test it?

Gaetano-Dati avatar Feb 01 '18 08:02 Gaetano-Dati

I'm talking about this issue: KeyStoreService.del null object reference on HUAWEI device 7.0 #25

I pasted this because we are in another thread. I found a solution to my first issue which is at the starting point of this list.

Gaetano-Dati avatar Feb 01 '18 08:02 Gaetano-Dati

@Gaetano-Dati No, unfortunately don't have a Huawei device for testing.

iamMehedi avatar Feb 01 '18 09:02 iamMehedi