I solved the problem with mcrypt (so I can build my own stuff if
necessary) but I'm still wondering if anyone else has advice on
reversible encryption in Cake...

Wayne

On 10/26/07, Wayne Fay <[EMAIL PROTECTED]> wrote:
> Hi bakers,
>
> I need a reversible encrypt function in Cake, and I need to be able to
> use it in a non-Cake PHP class as well. Basically I've got an export
> function that is nontrivial and previously written in PHP, and instead
> of rewriting things to make it work in Cake, I'm planning to encrypt
> the URL parameters with Cake and then decrypt them in my export
> function.
>
> I wrote a little EncryptionHelper using some code I took from
> www.php.com but it doesn't seem to be working in Cake though it works
> fine in "standard" PHP. I had to uncomment the
> "extension=php_mcrypt.dll" line in php.ini of course.
>
> Here's the error:
> Fatal error: Call to undefined function mcrypt_get_iv_size() in
> C:\dev\cake\app\views\helpers\encryption.php on line 18
>
> Here's the code:
> $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
> $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
> $key = "This is a very secret key";
> return urlencode(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256,
> $key, $text, MCRYPT_MODE_ECB, $iv)));
>
> So it seems like I can't use these built-in PHP functions for some
> reason... Any advice?
>
> Wayne
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to