react-native-keychain icon indicating copy to clipboard operation
react-native-keychain copied to clipboard

"Could not decrypt data with alias: "

Open WilliamAlexander opened this issue 3 years ago • 57 comments

Now and again I get the error: "Could not decrypt data with alias: "

Happens when I call Keychain.getGenericPassword() I don't use a service when calling Keychain.setGenericPassword (it uses the package name as default in Android).

Out of over 5k users, it happens for around 20 users (so far). 99% of the devices are Samsung. Tried myself on a Samsung phone and I cannot recreate.

Not sure if related to the user:

  • resetting their keystore
  • running of space
  • I'm storing a json object (as string) and maybe some devices have a string len limit
  • other

I'll eventually update the react-native-keychain package but holding off as it might cause further issues in this field

"react-native": "0.64.0", "react-native-keychain": "^6.2.0"

WilliamAlexander avatar May 03 '21 19:05 WilliamAlexander

  • Have you found any workarounds? i.e clear that alias entry from the keychain when that error occurs?

SudoPlz avatar Jan 03 '22 16:01 SudoPlz

  • Also have you noticed that it only happens on certain versions of react-native-keychain, but not on others? cc @WilliamAlexander

SudoPlz avatar Jan 03 '22 18:01 SudoPlz

  • Also have you noticed that it only happens on certain versions of react-native-keychain, but not on others? cc @WilliamAlexander

On "react-native-keychain": "^8.0.0", at the mo. Happens now and again. Thinking about moving to expo securestore at some point. https://docs.expo.dev/versions/latest/sdk/securestore/

WilliamAlexander avatar Jan 03 '22 20:01 WilliamAlexander

Thanks for the answer @WilliamAlexander. We're investigating what it would take to move to securestore as well.

SudoPlz avatar Jan 03 '22 21:01 SudoPlz

Thanks for the answer @WilliamAlexander. We're thinking of moving to securestore as well.

That's interesting. I was curious if any data I have in the keystores using this npm will be retrievable using the expo npm. I'd be interested to know if you do decide to take this approach.

I like expo npm packages (not cli as it's too bulky) and they are well maintained

WilliamAlexander avatar Jan 03 '22 23:01 WilliamAlexander

@oblador hey Joel, I'm wondering if you're aware of the issue above, and if there are plans on fixing it.

SudoPlz avatar Jan 20 '22 14:01 SudoPlz

On "react-native-keychain": "^8.0.0", at the mo.

Also seeing the Could not decrypt data with alias: error on 8.0.0. This issue and #430 might be related, #430 mentions Could not encrypt data with alias.

Considering patching react-native-keychain with https://www.npmjs.com/package/patch-package in our project by applying https://github.com/mattermost/mattermost-mobile/blob/master/patches/react-native-keychain%2B8.0.0.patch , which introduces a cache for the keychain.

lauriharpf avatar May 18 '22 13:05 lauriharpf

Considering patching react-native-keychain with https://www.npmjs.com/package/patch-package in our project by applying https://github.com/mattermost/mattermost-mobile/blob/master/patches/react-native-keychain%2B8.0.0.patch , which introduces a cache for the keychain.

Patched. The Could not decrypt data with alias errors still appear even with the patch. I don't currently have enough data to say if the patch affects the frequency of the errors, but at least it doesn't completely eliminate the error.

lauriharpf avatar Jun 01 '22 11:06 lauriharpf

Just FYI - we saw this error on a Google Pixel 4a running Android 12.

Versions:

    "react-native": "0.68.2",
    "react-native-keychain": "8.1.1",

savv avatar Aug 08 '22 07:08 savv

We have had had multiple users report this happening pretty often on Android. The ones that also reported device and api were:

Google Pixel 3 API 28 Motorola G Power, android ver. 11

"react-native": "0.66.1",
"react-native-keychain": "8.1.1"

Patch suggestion attempted but didn't work on our Google Pixel 2 API 30 test device.

kreonjr avatar Aug 22 '22 02:08 kreonjr

Having the exact same issue! Is there a workaround?

Only Android and mostly Samsung devices.

"react-native": "0.69.2",
"react-native-keychain": "^8.1.1",

ilyagru avatar Aug 26 '22 14:08 ilyagru

related to https://github.com/oblador/react-native-keychain/issues/567 I think :(

nicwise avatar Sep 15 '22 21:09 nicwise

faced the same issue on S22, Pixel 7, Xiaomi Redmi Note 9 Pro

"react-native": "0.68.2",
"react-native-keychain": "^8.0.0",

viLeeKorn avatar Nov 24 '22 15:11 viLeeKorn

Is there any workaround for this? Then please share.

aliza-khu avatar Sep 18 '23 06:09 aliza-khu

any updates on this?

davidecarpini avatar Oct 10 '23 07:10 davidecarpini

We are now seeing this more often as well, one of our users stated it happened after upgrading his Samsung (S21+) to the latest android version.

c-goettert avatar Oct 17 '23 14:10 c-goettert

The same issue here, Could not decrypt data with alias: for the devices below all running Android 13:

SM-G990E SM-G998B SM-G991U SM-G996B SM-G991B Pixel 4a

lucasftcruz avatar Oct 18 '23 14:10 lucasftcruz

I have the same issue with XUMM My device: SM-G991B/DS Last update: today (18 October)

Error message: "Could not decrypt data with alias: xumm-realm-key: java.security. InvalidKeyException: Keystore operation failed".

Is there a fix for this issue?

Ernst2106 avatar Oct 18 '23 19:10 Ernst2106

Also getting reports from users of this error in the last week 👍

seanquinn avatar Oct 19 '23 08:10 seanquinn

We have also started to see crash reports from our customers with the Samsung SM-G991B.

Does anyone know any workaround?

Frans-L avatar Oct 19 '23 13:10 Frans-L

Same here, Samsung SM-G991B is the problem. Using latest version : react-native-keychain 8.1.2

Seems to appear more frequently than before without any specific change from our side

TwistedMinda avatar Oct 19 '23 17:10 TwistedMinda

@TwistedMinda, we have seen a sudden increase of this error the last few days, starting to pick up on the 11th of October. Could it be that Samsung is rolling out a security fix that makes this issue worse? @TwistedMinda, are you able to reproduce it?

276756970-2b281617-258c-4a64-8134-72fc5154fc42

These are the devices we are experience this on: CleanShot 2023-10-19 at 23 54 08

yberstad avatar Oct 19 '23 21:10 yberstad

@yberstad No we don't have access to the specific device to reproduce. Can't confirm 11th either, we're seeing an urge from 19th, but we don't have many users with the problem. I don't think I can help more as we really don't have a lot of occurences. I can only confirm that it is becoming more frequent, with no apparent change coming from us!

I think a Samsung update is the most straightfoward reason, what else could have changed?

No user complained either. We'll keep an eye on it 👀

TwistedMinda avatar Oct 19 '23 22:10 TwistedMinda

@TwistedMinda, thanks for your quick response.

We are starting to get customer complaints regarding this, so we'll try to investigate further.

If we find workaround I'll let you know.

yberstad avatar Oct 19 '23 22:10 yberstad

I can confirm that it happened straight after installing Samsung's latest update (including security patch 1 October 2023) on my Galaxy S21 5G. I have preliminary 'solved' the issue by resetting Xumm's app data and re-importing my wallets. Xumm now functions normally. This solution would appear suboptimal to me, however.

Ernst2106 avatar Oct 20 '23 10:10 Ernst2106

Good to know, thanks for reporting! So that's a good news, it means the bug only happens once, when the data are already on the device, and further resetting the values don't cause problems. So supposedly the update messed up a specific space in memory, but only at installation time... Right?

Of course the need to reset app data depends on the implementation of catching the underyling error. We have a fallback in case of this error that doesn't block the user, so they don't need to reset app data.

TwistedMinda avatar Oct 20 '23 22:10 TwistedMinda

I will add this isn't happening only on Samsung devices. I have tons of Sentry reports of this error with Pixel devices. I wonder if anybody can confirm this same error doesn't occur with the Expo Secure Store library? I'm considering using that instead as well, but I don't know it's just this library.

bpeltonc avatar Oct 23 '23 16:10 bpeltonc

Also experiencing this, only on samsung phones per now. Screenshot 2023-10-24 at 08 53 17

joarkosberg avatar Oct 24 '23 06:10 joarkosberg

Seeing spike on our end, mostly the samsung devices mentioned above.

androideveloper avatar Oct 24 '23 18:10 androideveloper

Exactly the same issue with 100% Samsung Galaxy devices for now. This integration is not on Prod for now though tested with various Android devices, only the Samsung error logs have been seen. Screenshot 2023-10-25 at 11 50 28 AM

kamalesh100 avatar Oct 25 '23 06:10 kamalesh100