oblador / react-native-keychain

:key: Keychain Access for React Native
MIT License
3.19k stars 520 forks source link

Unrecoverable "Could not decrypt data with alias" on Huawei P30 Pro #466

Open pi-xel opened 3 years ago

pi-xel commented 3 years ago

Hi,

I am using react-native-keychain 6.2.0 and see this error when using getGenericPassword for all our users that have a Huawei P30 Pro.

The passwords are set via setGenericPassword with a custom service name and all other options as default.

I've already seen this error message for other devices (Google Pixel, Motorola Razr, some other Huawei devices, as reported in https://github.com/oblador/react-native-keychain/issues/371) but there the behavior was sporadic, i.e. sometimes it failed but then it worked again on the next request. So this was something that could be recovered on a higher level.

But on the Huawei P30 Pro the behavior is different, so I guess there's a different root cause.

There it works for some time, then it fails at some point with Could not decrypt data with alias: servicename and from then on all subsequent requests fail with the same error message until the password is set again using setGenericPassword.

I don't have a Huawei P30 Pro available at the moment to debug it myself.

Do you have any idea what the issue might be? Please also let me know if I can do anything to help further debugging this issue.

Thanks in advance and also thanks for creating this great library!

pi-xel commented 3 years ago

Addition: I don't know if this is related, but other errors I only see for the Huawei P30 Pro on getGenericPassword are:

Unknown error with alias: servicename, error: Failed to obtain information about key. Keystore error: 4 Unknown error with alias: servicename, error: Failed to communicate with keystore service

Either these errors or the Could not decrypt data with alias: servicename occur at some point (after working for a while, with the latter more frequently) and both appear to be non-recoverable.

pi-xel commented 3 years ago

Addition 2: I need to put a question mark to the "it works for some time" since the key in question is only read on app startup.

So it could be that the key actually never gets properly stored / can never be retrieved on the Huawei P30 Pro, but that the app works nevertheless until the user kills & restarts / updates the app for the first time after storing the key (since on first storing the key is already loaded).

leolusoli commented 3 years ago

+1

dkoprowski commented 3 years ago

This is still the case.

image
PouyaLitkouhi commented 3 years ago

Hey guys, I also have the same issue. have you find any solution to this?

SudoPlz commented 2 years ago

Same here, no solution so far..

savv commented 2 years ago

Just to add that I got this error for a Samsung device (SM-T813)

Apollon77 commented 1 year ago

Does anyone had luck maybe with version 8 to get rid of this error?