-1

I want to know how to safe and encryte to protect my cookie's datas in PHP and Codeigniter

and i want to learn about what the most secure encryption method, nonation

thanks.. :) !

Lutece
  • 127
  • 1
  • 1
  • 6
  • 1
    possible duplicate of [What encryption algorithm is best for encrypting cookies?](http://stackoverflow.com/questions/606179/what-encryption-algorithm-is-best-for-encrypting-cookies) – Adam Link Jul 09 '15 at 00:54

1 Answers1

0

For encrypt the cookie in codeigniter make changes in the config.php file at

$config['sess_encrypt_cookie']  = FALSE;

change this line to

$config['sess_encrypt_cookie']  = TRUE;

Also set the encryption key at

$config['encryption_key'] = "Your_own_key";

Please Note:

It's worth noting that you shouldn't rely on storing sensitive data with the client, even encrypted. You're more secure to just store the session id (or for longer life, a user id and checksum) in the cookie and keep the sensitive information under your own control in a database (again, encrypted). Using SSL mitigates this issue but it's still not an ideal solution. Also, Cookies can be cleared which may pose problems

Rajesh
  • 786
  • 6
  • 12