Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Crypt error

I am trying to decrypt a password using decryptBase64 but i got this error

Phalcon\Crypt\Exception: Size of IV is larger than text to decrypt

on my services.php i have

$di->set('crypt', function () use ($config) {
    $crypt = new Crypt();
    $crypt->setMode(MCRYPT_MODE_CBC);
    $crypt->setCipher(MCRYPT_RIJNDAEL_128);
    $crypt->setKey($config->application->cryptSalt);
    return $crypt;
}, true);

here is the code to decrypt

$this->crypt->decryptBase64(self::$u_pass);

here is the code to encypt

self::$password     = $this->crypt->encryptBase64(self::$password);


29.3k
Accepted
answer

owwww just figured it out,

$this->crypt->decryptBase64(self::$u_pass);

was trying to decrypt the password which is not yet encrypted. So it should be

$this->crypt->decryptBase64($encyptedpasswordfromdatabase);