Re: Encrypt and decrypt cookie

From: Date: Mon, 16 Dec 2002 16:36:35 +0000
Subject: Re: Encrypt and decrypt cookie
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-128420@lists.php.net to get a copy of this message
I am not a specialist, but I discovered the parameter iv and the related function create_iv. Most likely you must provide an created iv before encryption, store the cypher and the iv together in the cookie and at retreaval, use both in decrypt. So in between: /* Terminate encryption handler */ mcrypt_generic_deinit ($td); /* Initialize encryption module for decryption */ mcrypt_generic_init ($td, $key, $iv); you store and retreave from the cookie both $iv and $td. $key must be on your server. $iv must be some random stuff that changes between encryption and decryption (between sessions). Play with it and you will find out.

« previous php.general (#128420) next »