Welcome Guest, Not a member yet? Register   Sign In
Setting a default cipher
#1

[eluser]silentday[/eluser]
Ran into an issue with setting $config['sess_encrypt_cookie']= TRUE; and then trying to set set_cipher(MCRYPT_BLOWFISH) in a controller that handles some data encryption.

Session.php
Code:
if ($this->sess_encrypt_cookie == TRUE)
  {
   $cookie_data = $this->CI->encrypt->encode($cookie_data);
  }


It would appear that once the site loads up the cookie is encrypted using the default cipher, but once my controller sets the cipher it can no longer read the cookie data since the cookie data was created with a different cipher.

What is the best way to set the default cipher to use MCRYPT_BLOWFISH. I thought of trying to overload the _get_cipher() method which sets the default cipher:
Code:
function _get_cipher()
{
  if ($this->_mcrypt_cipher == '')
  {
   $this->_mcrypt_cipher = MCRYPT_RIJNDAEL_256;
  }

  return $this->_mcrypt_cipher;
}

Please let me know of your thoughts on the best approach.




Theme © iAndrew 2016 - Forum software by © MyBB