mibrito707 / cordova-plugin-secure-storage-echo

Secure storage plugin for Apache Cordova
MIT License
73 stars 73 forks source link

Fix stale key issue #61

Closed wzijden closed 3 years ago

wzijden commented 3 years ago

The isEmpty() check that was added after version 5.0.1 is causing issues when the Key becomes stale, eg. when a user changes their lockscreen. This check prevents a new key from being generated. Therefore we should get rid of it.

This should solve https://github.com/mibrito707/cordova-plugin-secure-storage-echo/issues/54

one-github commented 3 years ago

Dear @mibrito707, when will this PR be accepted? We have issue #54 with Android totally breaking our app, which is fixed by this PR.

Thanks!

benthieu commented 3 years ago

I can confirm that this PR solves the problem for me aswell. @one-github You could meanwhile use the fork as source for the plugin. For example in your config.xml

<plugin name="cordova-plugin-secure-storage-echo" spec="git+https://github.com/wzijden/cordova-plugin-secure-storage-echo.git" />

Or in your package.json

"cordova-plugin-secure-storage-echo": "git+https://github.com/wzijden/cordova-plugin-secure-storage-echo.git",
one-github commented 3 years ago

Thanks! I did it this way: npx patch-package cordova-plugin-secure-storage-echo

mibrito707 commented 3 years ago

Thank you @wzijden for your contribution :tada:

benthieu commented 3 years ago

@mibrito707 Will there be a new release soon?

olivierschmid commented 3 years ago

Will this Fix be included in a release soon? Thanks!

andreich-tut commented 3 years ago

Am I right that this fix is not yet in 5.1.1?

mateo2181 commented 3 years ago

Someone can confirm this fix solve the issue "Android - Error: KeyStore doesn't contain alias"? I've tried but I get the same error.

wmadam commented 3 years ago

The fix does not solve the issue.

Our app works with Secure storage on Google Pixel 3a But does not work e.g. with:

One Plus 5T Android Emulator x86_64 with API level 29

2021-01-15 14:35:23.073 8347-8573/XXXXXXXXXXXXXXXXXXXXXXXX E/SecureStorage: Encrypt failed : java.lang.Exception: KeyStore doesn't contain alias: XXXXXXXXXXXXXXXXXXXXXXXX at com.crypho.plugins.AbstractRSA.loadKey(AbstractRSA.java:75) at com.crypho.plugins.AbstractRSA.runCipher(AbstractRSA.java:44) at com.crypho.plugins.AbstractRSA.encrypt(AbstractRSA.java:60) at com.crypho.plugins.SecureStorage$2.run(SecureStorage.java:137) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:919)

mateo2181 commented 3 years ago

Doesn't work with Samsung Galaxy 8S.

yoavbar commented 3 years ago

both this issue and #54 may be solved by adding these to the application tag in the manifest: android:allowBackup="false" android:fullBackupContent="false"

silviuburceadev commented 3 years ago

@mibrito707 can we get a release for this issue?

nukithelegend commented 2 years ago

Any feedback? We're having the same problem

one-github commented 2 years ago

Revisiting as I stumbled across this bug (again). It bit me during testing. I manually deleted the app from the device (without having cleared the cache of the app first). Then re-installed it with Android Studio. It would bark because of missing Key Alias until I remembered to clear the cache of the app. After that it worked again. Whew.

it-wuye commented 2 years ago

@mibrito707 When will this fix be released?

it-wuye commented 2 years ago

@wzijden ... SharedPreferencesHandler storage = getStorage(INIT_SERVICE); .... This code is useless and can be deleted .

one-github commented 2 years ago

@wzijden ... SharedPreferencesHandler storage = getStorage(INIT_SERVICE); .... This code is useless and can be deleted .

Why don't you explain the reason? And in a neutral tone?

Like this: "Your pull request looks good, except the variable SharedPreferencesHandler declared in line 276 is not used anymore. You could delete this line."

Open source developers do a lot of their work in their spare time and deserve our respect.