Giter VIP home page Giter VIP logo

Comments (14)

adrientruong avatar adrientruong commented on July 19, 2024 3

Hi. I'm using this in an Android app and have users crashing on this problem. I read the Stackoverflow link you posted, however I am not 100% clear on what it means. Is there a fix for this issue or is it completely unavoidable?

from secure-preferences.

vashisthg avatar vashisthg commented on July 19, 2024 1

Hey will look into this,

Can you tell us about the android version and the device used?

cc @ragdroid @vickyturtle

from secure-preferences.

hearsilent avatar hearsilent commented on July 19, 2024 1

@vashisthg
I got the exception again.

05-13 11:41:46.757 20434-20434/com.hearsilent.example W/System.err: Caused by: java.security.InvalidKeyException: Failed to unwrap key
05-13 11:41:46.758 20434-20434/com.hearsilent.example W/System.err:     at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineUnwrap(AndroidKeyStoreCipherSpiBase.java:618)
05-13 11:41:46.758 20434-20434/com.hearsilent.example W/System.err:     at javax.crypto.Cipher.unwrap(Cipher.java:1707)
05-13 11:41:46.758 20434-20434/com.hearsilent.example W/System.err:     at in.co.ophio.secure.vault.SecretKeyWrapper.unwrap(SecretKeyWrapper.java:112)
05-13 11:41:46.759 20434-20434/com.hearsilent.example W/System.err:     at in.co.ophio.secure.core.KeyStoreKeyGenerator.loadOrGenerateKeys(KeyStoreKeyGenerator.java:78)
05-13 11:41:46.759 20434-20434/com.hearsilent.example W/System.err:     at in.co.ophio.secure.core.KeyStoreKeyGenerator.<init>(KeyStoreKeyGenerator.java:46)
05-13 11:41:46.760 20434-20434/com.hearsilent.example W/System.err:     ... 74 more
05-13 11:41:46.760 20434-20434/com.hearsilent.example W/System.err: Caused by: javax.crypto.IllegalBlockSizeException
05-13 11:41:46.761 20434-20434/com.hearsilent.example W/System.err:     at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:486)
05-13 11:41:46.761 20434-20434/com.hearsilent.example W/System.err:     at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineUnwrap(AndroidKeyStoreCipherSpiBase.java:616)
05-13 11:41:46.762 20434-20434/com.hearsilent.example W/System.err:     ... 78 more
05-13 11:41:46.762 20434-20434/com.hearsilent.example W/System.err: Caused by: android.security.KeyStoreException: Unknown error
05-13 11:41:46.763 20434-20434/com.hearsilent.example W/System.err:     at android.security.KeyStore.getKeyStoreException(KeyStore.java:632)
05-13 11:41:46.763 20434-20434/com.hearsilent.example W/System.err:     at android.security.keystore.KeyStoreCryptoOperationChunkedStreamer.doFinal(KeyStoreCryptoOperationChunkedStreamer.java:224)
05-13 11:41:46.764 20434-20434/com.hearsilent.example W/System.err:     at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:473)
05-13 11:41:46.764 20434-20434/com.hearsilent.example W/System.err:     ... 79 more

from secure-preferences.

marcinbak avatar marcinbak commented on July 19, 2024 1

@adrientruong @hearsilent @vashisthg I have exactly same issue (with same stack trace), that happens only on some Android devices... have you managed to find the reason of the problem or a way to fix it?

from secure-preferences.

marcinbak avatar marcinbak commented on July 19, 2024 1

@mjurekov @vashisthg @ragdroid I have found a workaround for this issue. The cause is https://issuetracker.google.com/issues/37137351

Created pull request with the workaround #26 but Travis seems not able to create emulator and failed check.

from secure-preferences.

hearsilent avatar hearsilent commented on July 19, 2024

LG Nexus 5X
Android 6.0.1

Thx :)

from secure-preferences.

vashisthg avatar vashisthg commented on July 19, 2024

@hearsilent
Please share the whole stacktrace.

Right now I think maybe the exception is related to key policy settings in your jdk.

from secure-preferences.

hearsilent avatar hearsilent commented on July 19, 2024

Oops, the whole stacktrace has disappear.
If I get the exception next time, I'll share the whole stacktrace for you.

Thanks for your help.

from secure-preferences.

vashisthg avatar vashisthg commented on July 19, 2024

@ragdroid @hearsilent I think the issue is due to key policy settings in the jdk as I too had it year back. A quick google search gives me http://stackoverflow.com/questions/6765240/rsa-aes-decryption-fails-invalidkeyexception .

from secure-preferences.

mjurekov avatar mjurekov commented on July 19, 2024

@vashisthg @ragdroid Any updates on this one?

@marcinbak / @adrientruong Have you maybe managed to solve the issue?

The same bug appears randomly on some Android devices in my app, however, after cleaning the app data the issue is gone. Could it be connected with writing/reading a key file from storage?

from secure-preferences.

AlexanderKovalchuk avatar AlexanderKovalchuk commented on July 19, 2024

Could we reopen this ticket again? I have same issue in my app.

from secure-preferences.

mjurekov avatar mjurekov commented on July 19, 2024

@AlexanderKovalchuk definitely. I'll try to reproduce it and will open another issue & PR once I'm sure where the problem is.

from secure-preferences.

Tygara191 avatar Tygara191 commented on July 19, 2024

I am also having this issue. Seems to be happening only when I minify my code, at least based on my observations. I am seeing it happen on my Xiaomi A1 with the latest /as of writing this comment/ Android Oreo update. No problems on my Xiaomi Redmi Note 4x, running MIUI9. That is just about all useful information I can provide.

from secure-preferences.

ttenushko avatar ttenushko commented on July 19, 2024

Did anyone try to set "android:allowBackup="false" in manifest?
This helped me

from secure-preferences.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.