kovmarci86 / android-secure-preferences

Secure AES Encryiption decorated Android SharedPreferences implementation.
38 stars 16 forks source link

Use secured-preferences on already existing project #3

Closed tprochazka closed 11 years ago

tprochazka commented 11 years ago

I'm thinking about adding secure-preferences to already existing project. Currently users will lost all preference data, because library can't decrypt non encrypted data. Did you think about it already?

Will be useful something like prefix for encrypted data with version identificator like "$sp-1-". And library will be use this to recognize if data are already encrypted. It allow also use different (more secure, faster) encryption in the future with backward compatibility for existing applications.

What do you mean?

kovmarci86 commented 11 years ago

This is a good idea. Just working on it. The question is: do we need to have the version in every key? My proposed implementation has a field for the version code (something similar to sqlite database versioning), which hold this version information. Have some util/factory methods to create secured instances. This will copy all the key-value pairs to a SecuredSharedPreferences instance.

tprochazka commented 11 years ago

Yes, your idea is better. But then you will must convert all items if version is different (or missing) and this conversion must be handled in one commit() (apply())

kovmarci86 commented 11 years ago

Exactly. The implementation will migrate all the entries in the SharedPreferences. Please take a look at the implementation in the last commits on the master branch. If you also agree, I thin we can close this issue.

kovmarci86 commented 11 years ago

Fix is added, closing now. If you have any idea, reopen or create new ticket. TY 4 ideas!

tprochazka commented 11 years ago

I will start testing it soon. Thanks! Great job.

tprochazka commented 11 years ago

It's look very good. I tried use it on project has stored some data in plain format and it looks that migration was succesufll. Great work!