Welcome Guest, Not a member yet? Register   Sign In
Odd encryption problem
#1

[eluser]Christophe28[/eluser]
Hi,

I encrypt my cookies and use a session database.

On my website you can upload a photo using AJAX (and Flash). I get the encrypted cookie from the users webbrowser:

Code:
getCookie()
(I cannot post the actual code here, because it is [removed] Wink

The encrypted cookie is send as a parameter in JS, because Flash itself doesn't send it. At the server, I capture the encrypted cookie and I want to decode it again:

// Decode the encrypted session
$cookie = $this->encrypt->decode($enc_cookie);
$cookie = unserialize($cookie);

This worked fine until this afternoon for some strange reason ...?

The $enc_cookie is send to the server, but for some reason the decode() gives 0 as a result ...

Does anybody know what the problem might be? It suddenly appeared.

Thanks for any help!

Christophe
#2

[eluser]Christophe28[/eluser]
I just noticed when I console.log(getCookie()) in JS, the result is:

/gVP3o9y0pqMDE+koTqJkBI8KJZYrpudQsCo+DAT9YIGFqE5mJ5tZLBGW/omXAEvSgIeUlXMZxmQ5Gzd7Jg6mQaqz6RWhxqAdn+AXcYepC2iCE58GaGBSSwIuwOV2+YaPQW5Db6bp2WkauqTlhgQSd07G/Z2j1QIL6usP5VBz5/JHJxe53Mu+9mHZoebOaSLy6brlVMnu+3XqL/tWe5LHOspEl/i9H/8FIB1ojMeh9EHM3G6AZY2LD56PvlwYInGJJ5Co4aQrJkfC8flIc8v9pPAcNDs2x+8MTVicq2hqooDS4l+15v1EodYmRSYPu4QhAFWQpSBXnbFI1MxmB5Yww==; __utma=252764940.1735391691.1313240091.1313240091.1313240091.1; __utmb=252764940.10.10.1313240091; __utmc=252764940; __utmz=252764940.1313240091.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)


And when I capture the encrypted cookie in PHP, the result is:

/gVP3o9y0pqMDE+koTqJkBI8KJZYrpudQsCo+DAT9YIGFqE5mJ5tZLBGW/omXAEvSgIeUlXMZxmQ5Gzd7Jg6mQaqz6RWhxqAdn+AXcYepC2iCE58GaGBSSwIuwOV2+YaPQW5Db6bp2WkauqTlhgQSd07G/Z2j1QIL6usP5VBz5/JHJxe53Mu+9mHZoebOaSLy6brlVMnu+3XqL/tWe5LHOspEl/i9H/8FIB1ojMeh9EHM3G6AZY2LD56PvlwYInGJJ5Co4aQrJkfC8flIc8v9pPAcNDs2x+8MTVicq2hqooDS4l+15v1EodYmRSYPu4QhAFWQpSBXnbFI1MxmB5Yww==; __utma=252764940.1735391691.1313240091.1313240091.1313240091.1; __utmb=252764940.10.10.1313240091; __utmc=252764940; __utmz=252764940.1313240091.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)

There is some slight difference ... Is that what the problem might be?

Christophe

EDIT: Since I post it on a CodeIgniter based forum, the difference here is gone :-) The difference lies within 'percent signs' in the cookie, but not at the server ...
#3

[eluser]Christophe28[/eluser]
Problem solved!

The issue was I just implemented Google analytics. In JS, I used a getCookie() functions which posted the whole cookie to the server. Since Google analytics add some information to the cookie, this was also send to the server which caused the encryption error!

Thanks for helping guys! :-)




Theme © iAndrew 2016 - Forum software by © MyBB