sromku/android-storage

Impossible to read encrypted file after application restard

ThomasEhling opened this issue · 10 comments

The library is working fine, I can encrypt and open file without any issues during one app lifetime.

But when I open my application again, I can't read the file I have encrypted Iast time, even when I am using the same IVX, SECRET_KEY, and SALT the both times.

What Sould I do ?

Regards,

Can you show the error message you get? You have to see it in logcat.

I've got no message in logcat, It told me the same thing that if I try to open it from app folder, it launch the viewer then tell me "the file is damaged" and close the viewer. There is nothing in the logs.

The array bites that I have encrypted can be decrypted right away, but can't be decrypted when i launch the app again. Even when i create a new EncryptConfiguration which has the same ivx, secret key and salt than the previous one

Are you running this from sample app or your own code?

my own code, following your indications

if there is any specification I can give, I'll be pleased to provide it. I'm stuck on this for a while now

Sure.
Please check the sample app. In the sample app, you can create a text file and encrypt it. Then, kill and open the app and you will able to decrypt and see the content.
Beside this, share your code here and I can say what might be an issue.

I already watch your ap sample, and really don't know why It is not working.
Unfortunately I can't post my code here, but Can I please e-mail it to you ? My code is a really easy one. Then I could Post the Answer here.

Yes, send it to me

Thanks you very much for your help.
My issue was indeed in my code and have nothing to do with your library.
Thanks again, and good luck for your future projects.

Glad to help :)