I am developing an Android app.
Because of the security, I should encrypt/decrypt private data.
Until now, I just store them into the SharedPreference as a Plain Text.
Because there are many sample codes on the web, applying Android KeyStore was not difficult.
Now I have "encrypt", "decrypt" methods.
The problem is...
Many user's data are already stored into the SharedPreference as a Plain text.
Because my app will try to decrypt the plain text, if I update this app they will face crush or wrong behavior.
Then...
How can I keep the compatibility?
Actually, when I update my app, I faced the IllegalBlockSizeException.
So I think that if I catch the IllegalBlockSizeException on the "decrypt" method and return just Plain text, my app will work fine.
But I don't know it is right or not...
Could you tell me advice, please?
if else
logic to your code to decide whether to en/decrypt or not by your app version?storage path/SharedPreference name
and implement your en/decrypt logic. Then your old SharedPreference data will be ignored. Idk about the risk for your business logic.