Click here to Skip to main content
15,867,939 members
Please Sign up or sign in to vote.
2.40/5 (2 votes)
Our requirements is to persist some of the data on the client side as the part of local storage as we have a need to access our application offline also, but we want that some of those file should be encrypted for some reasons but that encryption and decryption should not be completely on client side as it will be than accessible for clients too (security threat) and if it will be dependent on server side than it will be problem for offline access .

in a nutshell i want an application that will be accessible offline too. with some encrypted file (stored on client side) and that encryption method (as well as the files) must also be really secured.

i don't have any idea about how to overcome this problem (i also don't have much idea about encryption and decryption and its algorithms). any suggestion that how this problem can be solved ??
Posted
Updated 2-Dec-13 0:37am
v2

First of all,every road has two ends,you can not go through both at one time,did you get it?Well,offline itself means that forget about server as you don't have access to it,so encryption can't take place in this case. You can not perform any server activities.

Secondly,you can store data using Viewstate at client. That will be in form of base64 encoded string by default. You can retrieve it whenever you want. Remember,no encryption is secured.
 
Share this answer
 
Comments
akki166786 2-Dec-13 6:02am    
@Rohan i agree with what u said,so what is the alternative solution to the problem to secure the data on client side and the data is being stored in the local storage(HTML5), is there any way to solve it out?
Thanks7872 2-Dec-13 6:05am    
Always remember,if you consider the client,there are limitations on what you can do in any technology.
Sampath Lokuge 2-Dec-13 6:16am    
Yep.You're right.My +5
Thanks7872 2-Dec-13 6:17am    
Thanks Sampath.
You can use one of the below mentioned jquery plugin to do your work.

If you need one way encryption,use MD 5 plugin.
MD5 Encryption using jQuery

This supports both ways (i.e. encryption and decryption):
RC4 Symmetric Encryption/Decryption

UPDATE

Quote:
Final Thoughts on Local Storage and Security

Don't use local storage for session identifiers. Stick with cookies and use the HTTPOnly and Secure flags.

If cookies won't work for some reason, then use session storage which will be cleared when the user closes the browser window.

Be cautious with storing sensitive data in local storage. Just like any other client side storage options this data can be viewed and modified by the user.


For more info : How to secure localStorage in HTML5?
 
Share this answer
 
v5
Comments
Thanks7872 2-Dec-13 2:54am    
MD5 is one way. You can not decrypt the value.
Sampath Lokuge 2-Dec-13 2:59am    
Yep,But 2nd plugin will be worked for OP.
Thanks7872 2-Dec-13 3:01am    
Yes. I voted 1 by mistake. I countered it now vote is +4. You should remove the first link.
Sampath Lokuge 2-Dec-13 3:02am    
Yep,Thanks.No problem :)
Sampath Lokuge 2-Dec-13 3:06am    
I have updated my answer.Thanks :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900