Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Recommendations for client-side state management

by fullermd (Curate)
on Nov 22, 2011 at 23:56 UTC ( #939561=note: print w/ replies, xml ) Need Help??


in reply to Recommendations for client-side state management

I do similar things with just stuffing data in a hidden field for long stuff like that. I don't see any reason to bother trying to encrypt it; if the user wants to put crap data in, they could already have done that in the first place. Just have to validate it on submission.

Or, if you really do want to encrypt it, you don't need any special CGI-ish thing for that. Just AES/Serpent/etc the serialized string (whatever format it may be in) and dump that in the form field. Gen up a new key for each session, and just use that for all their forms, should be plenty secure enough.

An additional option would be to instead of storing in the DB just for the session, create a new little opaque key for each run through a form (a sha256(time()) type construction would be fine; just bitstirred pseudorandomness) and use that and the session for storing it. That way you could have multiple stored saved bits per session, and you just need to stick that key in a hidden field in the form.


Comment on Re: Recommendations for client-side state management
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://939561]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2014-07-26 11:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (176 votes), past polls