Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to secure cookies?

I am using JQuery.cookies to manage cookies. I am storing objects and user/login informations.

Is there a way to encrypt or secure the cookies? or is it possible with SSL only?

like image 650
Vural Avatar asked Dec 19 '12 10:12

Vural


2 Answers

The usual way to secure cookies is by storing nothing but a randomly-generated session-id in them. The server keeps all sensitive information and associates them to the IDs it assigned to each visitor. This also has the advantage that you can store as much information as you want and are not bound to the space restriction of cookies.

This, of course, can not be done with Javascript alone. You will need server-sided programming for that.

like image 88
Philipp Avatar answered Sep 21 '22 16:09

Philipp


You can simply store them as encrypted strings and once you retreive them then decrypt them. Any encryption with your secret key will do

like image 28
Hanky Panky Avatar answered Sep 19 '22 16:09

Hanky Panky