Answer the question
In order to leave comments, you need to log in
Should I store encrypted data in a cookie?
Is it worth storing data with the user that can only be decrypted on the server? For example, JSON strings with data (name, personal settings, etc.) of the user. Can there be problems?
Answer the question
In order to leave comments, you need to log in
Cookies are needed to store a small amount of data (these are not pies). If you want to push the user session there (and this can be a lot of information), then get ready for a lot of traffic.
PS I would not engage in such perversions.
Some not the most secret data is of course possible. For example, in Laravel there is an implementation of sessions on encrypted cookies (although I would not dare to store the session in this way).
they usually do this:
on the server, they create some user session, the
session has a unique number / key
, this key is stuffed into cookies
, everything that needs to be stored for this user is added to the database and hooked to this key
When the user makes a request to the server, you can pull out information by key .
PS: this is about data storage.
But in general - you only need a session ID so that the server understands what kind of client it is, and store everything else where you want. But if the question of storing data on the client has already arisen, then think about it - is it worth considering cookies as such storage? Are you aware that cookies are sent in the clear on every request to the server?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question