Welcome Guest, Not a member yet? Register   Sign In
Encryption Issue
#1

[eluser]Uresh Patel[/eluser]
HI,


I have used this "Encryption" library to hide my URL id.

http://localhost/project/premium/premium...t_profile/
Quote:O33o5xz0SQb8Jh/LAYMEMteHXT77mwquyFsJUVFpVubSuztJxsox/5jxXenZQ8qBsJBW0aYCW7qsJnpQ6aEGSA==

Code:
$encrypted_user_id = $this->encrypt->encode($user_id); // in View file

When receiving in controller

$decrypted_user_id = $this->encrypt->decode($this->uri->segment(3));
What happen in above case that when the encrypt key generated it generates with "/" in string....
It is making trouble to CI to read this.."/" refers to parameters....that i think blunder.

Anyone have any idea to overcome this issue ?
#2

[eluser]Unknown[/eluser]
Hello,

I'll recommend you after make the encode procedure use base64 string to send it to the client and then decode the base64 string in the server and decode the cipher string as last step.

In that way you'll avoid not allowed characters.
#3

[eluser]TheFuzzy0ne[/eluser]
Try this: http://ellislab.com/forums/viewthread/107741/

It's old, but it should still work.
#4

[eluser]Uresh Patel[/eluser]
Hi,
I have finally implemented this process and vise-verse for decode using HELPER.

Code:
function url_base64_encode($text)
{
     $salt = config_item('encryption_key').date("Y-m-d");
        return trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $salt, $text, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))));
}

Thank You

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
#5

[eluser]TheFuzzy0ne[/eluser]
That won't be URI-safe unless you do the character replacements.
#6

[eluser]pickupman[/eluser]
I have added the URI to a session variable, and then just decode on whatever page you need. I would redirect to controller/method/(random string). Then just decrypt the session information as needed.




Theme © iAndrew 2016 - Forum software by © MyBB