react-native-keychain: com.oblador.keychain.exceptions.CryptoFailedException: Wrapped error: null
I encountered an issue when calling the getGenericPassword method from react-native-keychain.
My usage is:
await Keychain.setGenericPassword(username, password, { service: USER_KEY123456 });
await Keychain.getGenericPassword({ service: USER_KEY123456 });
Some users randomly experience the following error:
com.oblador.keychain.exceptions.CryptoFailedException: Wrapped error: null
This issue seems device-specific and occurs randomly, making it difficult to reproduce consistently. Does anyone have experience with this problem or suggestions on how to resolve it?
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 36 (6 by maintainers)
@phamngocthinh @Bowlerr I now have permanent physical access to the Razr 2024 and have been testing with the example app. I can now help test any changes as needed.
I tired both the latest
main, as well as #736, and they both return the same error, the same as @cjanietz.https://github.com/user-attachments/assets/a99f44c7-1bb5-42b0-bdd7-5b15abd657c5
Also had users experience this issue 😃 if you could let us know the fix once you are done so I can get it patched asap. Thanks for all the hard work @DorianMazur
I have tried the fixed version from #736 and it does not seem to fix it for me Error remains:
@Bowlerr @SYoder1 The prefix might help with some of the issues, but after thinking about it, I don’t believe it’s the root cause of the error. This is a general error, so the first step should be to add better error handling. I’ll look into it further, I think it is an edge case and quite hard to reproduce. Prefix was my first guess as it’s something I want to change for quite some time.
Agree, but also strongbox is not performing well on devices with specific chipsets, so it’s even harder to manage it when it’s enabled
I am seeing the same, but the errors are very heavily weighted to the Motorola Razr
@DorianMazur Thank you so much for feedback on this issue, Could you suggest any temporary workaround that we can apply for affected customers? Also, do you have an estimated timeline for when the fix will be officially released?
I’ve identified the root cause: When using a custom service:
sometimes the AES_GCM cipher storage is attempting to use the same keystore alias in both ciphers AES_GCM and AES_GCM_NO_AUTH. This alias collision is triggering the error you’re experiencing. I am working on a fix.
I’m using version 9.2.2 of react-native-keychain.