Tushar Ahirrao
Tushar Ahirrao

Reputation: 13115

Encrypt Cookie in browser

I want to encrypt cookie in browser

Please tell me the different ways to do this

Thanks

Upvotes: 4

Views: 4483

Answers (2)

user220201
user220201

Reputation: 4534

You never encrypt cookies. If you have to then your security model is flawed. You should tell more about the problem you are trying to solve for us to help you better.

EDIT: Why the downvote? Explain when you disagree.

Upvotes: 1

Zed
Zed

Reputation: 3385

Your question isn't very clear. You should use HTTPS for the connection and set the secure flag to make sure that the cookie is always sent encrypted. I assume that is what you want to do.

If you're thinking about doing your own encryption in JavaScript then don't do it because you won't get the level of neither security nor performance anywhere near that of SSL/TLS that the browser has already built in.

If you're serious about cookies security then I recommend reading the Secure Cookie Protocol paper by Liu, Kovacs, Huang and Gouda (PDF).

Upvotes: 7

Related Questions