Phalcon\Crypt() Question

Hello,

I'm using ( studying =) ) Phalcon 1.1.0 and according documentation http://media.readthedocs.org/pdf/phalcon-php-framework-documentation/latest/phalcon-php-framework-documentation.pdf Tried to test Encryption functionality and used following code:

$crypt = new \Phalcon\Crypt(); $key = 'le password'; $text = 'This is a secret text'; echo $encrypted = $crypt->encrypt($text,$key); echo $crypt->decrypt($encrypted,$key);

Unfortunatelly it fails with error: Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in \test.php on line 59

Can you tell me in what my mistake or show a working code example.

P.S. I've also tryied following code:

$crypt = new \Phalcon\Crypt();

$crypt->setKey('le password') ->setCipher('cast-256') ->setMode('ofb'); $text = 'This is a secret text'; echo $encrypted = $crypt->encrypt($text); echo $crypt->decrypt($encrypted);

Usually it throw an error: Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in D:\Internet\ext.dev\www\zz-consulting\test.php on line 62

though sometimes success, maybe in 10% of all calls

Thank you.



84.5k

Hi, could you check using the latest DLL? (uploaded today)



2.9k

Hello!

Unforytnatelly no changes. Used:

x86 Phalcon 1.1.0 - Windows x86 for PHP 5.4.0 (VC9) Updated: May 07 2013 09:49:23 COT