-
Notifications
You must be signed in to change notification settings - Fork 1.2k
GeneralSecurityException: decryption failed #321
Comments
Could you please provide more information? For example, why do you think this is fixed in 1.3.0-rc4?
Yes. 1.3.0 cannot be used with Firebase, I'm so sorry about this, but there's little we can do at the moment. I hope that we can make 1.4.0 work with Firebase. |
Hi, is there an updated timeline on 1.4.0? The roadmap says Feb 2019 (https://github.com/google/tink/blob/master/docs/ROADMAP.md). We are possibly going to roll our own branch with Firebase-compatible protobufs since this is blocking us |
We're working very hard on 1.4.0. The main blocker is Tink for Python, but it's getting ready. We think it should be ready by end of April. Note that it's very unlikely that we will be able to resolve the protobuf issue with 1.4.0. |
Thanks for the update! |
We've been using 1.3.0 and we have @amytang0 what modifications did you have to have Tink become Firebase-compatible? |
Thanks @thaidn Would you be able to elaborate on the commits and causes for the fixes? I'm puzzled specifically about this and the Protobuf errors. Seemed like a series of fixes if addressing both the Protobuf and decryption problems, but I don't know for sure why. |
So I'm still getting this
I'm currently using Tink 1.4.0 rc2, and AndroidX security 1.0.0 rc02 which uses Tink 1.4.0 rc2 underneath. I don't think there is anything special about what I am storing. For example, I am storing strings that look like this
The error rate I'm seeing is around 0.3% of users which isn't a small number of users. And this happens when using Tink with the Android keystore However, if we were to use Tink without the Android Keystore, I barely get any errors in decryption errors. Error rate for that is 0.0001%. So I'm wondering if this is related to @thaidn your other comment where I first asked
And you @thaidn responded
to which I responded
|
@simtse could you please provide a stack trace? Edit: ah sorry, saw your stack trace. I'm investigating and will provide a more meaningful update later. |
Not much difference with the AndroidX stacktrace posted above (I think that is what you want)
We don't see the logs from
We haven't been able to reproduce this in debug and locally though we've seen the issue affect more than 19,000 users over the last 3 months in production. Can you clarify which stacktrace you're looking for? |
Have you observed any logging statements from AndroidKeysetManager on these devices? Edit: oh you said you haven't seen any log. That's strange. I still don't understand what happened. |
😞 No we haven't observed or seen the logging statements because we can't reproduce locally that represents what's happening to our users in production. We also won't see the info logs from our production users in our reports because the |
A theory is that the Then since that keyset is not matched to the encrypted cipher text, it fails to decrypt. I've had some tests that had
|
Thank you all for your reports and comments. Here's what we're doing to do: 1/ Tink will disable Android Keystore by default. Users can enable it by setting a master key URI, but Tink will run a self-test and disable it if it detects any issues. We recommend keeping Android Keystore disabled unless you have a very strong reason to depend on it. 2/ Tink will only generate a new keyset or a new master key if there's no existing key material. Currently Tink attempts to generate a new keyset or a new master key whenever it can't read the existing key material. This behavior is useful in certain cases, but it hides the actual problems in Android Keystore from Tink users. |
Will clients already affected by the AndroidKeystore issue be able to recover when this new idea is implemented? |
@eygraber Unfortunately I'm not sure. If you had some data encrypted with a keyset that is in turn wrapped by a master key in Android Keystore, you won't be able to recover the data if the master key is lost :-(. I'm really sorry that Android Keystore is so unreliable. I regret the decision to use it in Tink in the first place. The new change will only tell you exactly what happened, as Tink shouldn't hide the error anymore. The best way to move forward on devices that are having problems is to disable Android Keystore, by not setting a master key URI. Again, existing data will be lost but new data should be safe. If you really have to use Android Keystore, you can still do that by setting a master key URI. Tink always does a self-test and disables it if necessary. Though on devices Android Keystore transitions from working to not working, data during that period will be lost. Edit: add the last paragraph. |
Thanks @thaidn I'll bring this back to my team and I'll need to internalize what this means for us and our users. But sounds like if we set a master key, then Tink will try to continue to use the Android keystore. But if not, then it will use Tink with the keyset saved in SharedPreferences as clear text.
I think this was happening to me because it coudln't read the key material, but there wasn't any extra feedback or callback to notify my code that this regeneration happened. Are you suggesting that there will be an API change to notify the callers that this regeneration or what happened underneath so the calling code can make adjustments? |
https://github.com/google/tink/releases/tag/v1.4.0 was released a few minutes ago. It includes several, backward-compatible changes to the Android Keystore integration. Please consult the release notes.
As explained in the Javadoc:
Please comment if you have any other questions. |
This error occurs with version 1.3.0-rc1 on an Android device running 9.0 but is fixed in versino 1.3.0-rc4. We can't upgrade to 1.3.0-rc4 because of #301.
Will the 1.3.0 release contain the fix for the decryption error but not the issue with firebase?
The text was updated successfully, but these errors were encountered: