Closed jeprojects closed 10 months ago
Seems that the value that you are trying to decrypt is not properly padded. This could be the case when you are writing a value and while that is in progress your app crashes.
Hi, I am also facing this issue, but I get it only for some phones. Situation: Published app via PlayStore (Test Environment). The issue occurs only when the app is installed for the first time. Incremental updates are not throwing this issue. After clearing the data, it will work.
Any ideas?
I'm running into this problem also, but the app is neither crashing or being closed when it's being written too.
This happens after clearing data on android. I plunged into Kotlin code and found an interesting error there.
The author stores the AES key in preferences, and when the keychain.clear() method is called from Dart, preferences.clear().commit() is called in the Kotlin code. So the key is erased from the store and after a person tries to read any value from the store, the AES key is unavailable and therefore this error is thrown.
To fix this problem you need to do one of the following: 1) Save the AES key before clearing the preferences and then write the key back. To do it write this in FlutterKeychainPlugin.kt in 319 line:
val savedValue: String? = preferences.getString(AesStringEncryptor.WRAPPED_AES_KEY_ITEM, null)
preferences.edit().clear().commit()
preferences.edit().putString(AesStringEncryptor.WRAPPED_AES_KEY_ITEM, savedValue).commit()
result.success(null)
2) in the Dart code, after deleting the Keychain, also do the cleaning of shared preferences (don't know why it helps) 3) In the Dart code, create an array of keys that you use in the application and, instead of clearing keychain, go through these keys and set them to null.
Sometimes getting this error:
It happens in the emulator normally after an app crash. I have to then clear the data from the app and login again to the application (which imports the data into the keychain again).
Any ideas?