There is already a discussion about this, but i want to open a new one, since i am on Ubuntu. Basicaly decrypt it is not working. Here is my example:
$crypt = new \Phalcon\Crypt();
$crypt->setKey('mykey');
ld($crypt->getAvailableModes());
ld($crypt->getAvailableCiphers());
echo $crypt->encryptBase64("calin");
echo "\n";
echo $crypt->decryptBase64("calin");
Results:
array (8)
· [0]: string (3) "cbc"
· [1]: string (3) "cfb"
· [2]: string (3) "ctr"
· [3]: string (3) "ecb"
· [4]: string (4) "ncfb"
· [5]: string (4) "nofb"
· [6]: string (3) "ofb"
· [7]: string (6) "stream"
/project/apps/Tasks/UserRegistrationTask.php:25
array (19)
· [0]: string (8) "cast-128"
· [1]: string (4) "gost"
· [2]: string (12) "rijndael-128"
· [3]: string (7) "twofish"
· [4]: string (7) "arcfour"
· [5]: string (8) "cast-256"
· [6]: string (6) "loki97"
· [7]: string (12) "rijndael-192"
· [8]: string (9) "saferplus"
· [9]: string (4) "wake"
· [10]: string (15) "blowfish-compat"
· [11]: string (3) "des"
· [12]: string (12) "rijndael-256"
· [13]: string (7) "serpent"
· [14]: string (4) "xtea"
· [15]: string (8) "blowfish"
· [16]: string (6) "enigma"
· [17]: string (3) "rc2"
· [18]: string (9) "tripledes"
/project/apps/Tasks/UserRegistrationTask.php:26
FyWhBJksVoR8VodnHWtXwofM1+P6UunFEOeKsbstNRMXkKOn+UlimzNT1IgKk+izUkPioncQPW619jTVz0YbZg==
Size of IV is larger than text to decrypt
If I use just encrypt() and decrypt() :
�<z����9����k
2K����1��6����
BXѻN�c�7s��9��A�6a��<-c*�x
PHP Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /project/apps/Tasks/UserRegistrationTask.php on line 32
{9tc��o��v_uS���U��/<�Ƕ'V
This might be a bug in the end. Maybe @Phalcon can confirm ?