Comments (14)
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.
Hey will look into this,
Can you tell us about the android version and the device used?
from secure-preferences.
@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.
@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.
@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.
LG Nexus 5X
Android 6.0.1
Thx :)
from secure-preferences.
@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.
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.
@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.
@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.
Could we reopen this ticket again? I have same issue in my app.
from secure-preferences.
@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.
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.
Did anyone try to set "android:allowBackup="false" in manifest?
This helped me
from secure-preferences.
Related Issues (20)
- Won't work when user will change security code/schema... HOT 2
- Add to readme the issue discussed in #10
- java-aes-crypto HOT 3
- How I can use this library to decrypt the saved data? HOT 3
- Deprecated code after Android M HOT 2
- NoSuchAlgorithmException HOT 1
- SharedPreferencesListener
- Proguard Issue
- KeystoreConnectException HOT 1
- Exception in Application Class while Starting the Application
- W/KeyStore: KeyStore exception android.os.ServiceSpecificException: HOT 1
- Issue with KeyStore on android 9
- AES only supported by Android API 23+
- What is the used algorithm for encryption?
- What is the used algorithm for encryption?
- Issue with KeyStore on Android 5.1
- minSdkVersion 16 possible? HOT 1
- implement `getAll()` in ObscuredSharedPreferences. HOT 1
- Is it possible to make minSdk=14 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from secure-preferences.