Welcome Guest, Not a member yet? Register   Sign In
Encrytion class works only once
#1

[eluser]bleu[/eluser]
I am using codeigniter encryption class and I use it a s follows

Code:
$this->load->library('encrypt');

$encrypted_string = $this->encrypt->encode($string);

Pass the encrypted string in the url as a querystring

Then get the value in view2.php

Code:
try{
$this->load->library('encrypt');
            $string = $this->encrypt->decode($to_be_decrypted);
} catch (Exception $ex) {

            $string = "Wrong Value. ";
        }


Problem is first time that I do it in view2.php I get the proper value after that I just get Wrong Value.
#2

[eluser]RiccardoC[/eluser]
Is it possible that you encrypt the already encrypted data?
Try to "echo" the $to_be_decrypted variable and copy/paste it on a text file so that you can verify that all the encryption go well
#3

[eluser]bleu[/eluser]
[quote author="RiccardoC" date="1334254284"]Is it possible that you encrypt the already encrypted data?
Try to "echo" the $to_be_decrypted variable and copy/paste it on a text file so that you can verify that all the encryption go well[/quote]

No that is not the case I have also specified one single fixed value in a variable to be encrypted and then decrypted. It is just executing once.

After that it takes that fixed value but is not able to decrypt it.

Th variable value does not change

#4

[eluser]Aken[/eluser]
There's nothing in the encryption library that would cause it to "not work a second time". It has to do with your code. Maybe try posting more about how you're setting and retrieving the variables or something.
#5

[eluser]bleu[/eluser]
[quote author="Aken" date="1334347714"]There's nothing in the encryption library that would cause it to "not work a second time". It has to do with your code. Maybe try posting more about how you're setting and retrieving the variables or something.[/quote]

The issue seems to be that when I the query string is got using the get method it runs urldecode by default which is causing the error .


Any Ideas as to how I can solve it?




Theme © iAndrew 2016 - Forum software by © MyBB